diff cmd2.py @ 122:e62aa2f58b7b 0.4.1

now works Python 2.4 to Python 2.6
author catherine@dellzilla
date Wed, 29 Oct 2008 10:53:11 -0400
parents fe432d010ecc
children fad4dde06be8
line wrap: on
line diff
--- a/cmd2.py	Wed Oct 29 10:46:08 2008 -0400
+++ b/cmd2.py	Wed Oct 29 10:53:11 2008 -0400
@@ -745,7 +745,7 @@
             return result
         except StopIteration:
             return self.transcript[self.bookmark:]
-        
+
 class Cmd2TestCase(unittest.TestCase):
     '''Subclass this, setting CmdApp and transcriptFileName, to make a unittest.TestCase class
        that will execute the commands in transcriptFileName and expect the results shown.
@@ -769,11 +769,11 @@
                     (self.transcriptFileName, lineNum, cmdInput, expected, result))
     def stripByLine(self, s):
         bareprompt = self.cmdapp.continuationPrompt.strip()
-        lines = (line.rstrip() for line in s.splitlines())
-        lines = (   line.replace(bareprompt, '', 1) 
-                 if line.startswith(bareprompt)
-                 else line
-                 for line in lines)
+        lines = []
+        for line in s.splitlines():
+            line = line.rstrip()
+            if line.startswith(bareprompt):
+                line = line.replace(bareprompt, '', 1)
         return '\n'.join(lines).strip()
     def tearDown(self):
         if self.CmdApp: