# HG changeset patch # User catherine@dellzilla # Date 1225291991 14400 # Node ID e62aa2f58b7b5355820510fca1f4759470e6722e # Parent fe432d010eccc7fb4b81580132214412a786c671 now works Python 2.4 to Python 2.6 diff -r fe432d010ecc -r e62aa2f58b7b cmd2.py --- 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: