Mercurial > python-cmd2
changeset 107:3e2651cbe376
vigorous whitespace stripping from test results
author | catherine@dellzilla |
---|---|
date | Fri, 24 Oct 2008 16:13:47 -0400 |
parents | 2d3232693807 |
children | f7b0152c57f9 |
files | cmd2/cmd2.py cmd2/exampleSession.txt |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd2/cmd2.py Fri Oct 24 16:03:58 2008 -0400 +++ b/cmd2/cmd2.py Fri Oct 24 16:13:47 2008 -0400 @@ -762,9 +762,12 @@ self.cmdapp.onecmd(cmdInput) result = self.outputTrap.read() expected = self.transcriptReader.nextExpected() - self.assertEqual(result.strip(), expected.strip(), + self.assertEqual(self.stripByLine(result), self.stripByLine(expected), '\nFile %s, line %d\nCommand was:\n%s\nExpected:\n%s\nGot:\n%s\n' % (self.transcriptFileName, lineNum, cmdInput, expected, result)) + def stripByLine(self, s): + lines = s.splitlines() + return '\n'.join(line.rstrip() for line in lines).strip() def tearDown(self): if self.CmdApp: self.outputTrap.tearDown()
--- a/cmd2/exampleSession.txt Fri Oct 24 16:03:58 2008 -0400 +++ b/cmd2/exampleSession.txt Fri Oct 24 16:13:47 2008 -0400 @@ -14,7 +14,7 @@ (Cmd) say --shout goodnight, Gracie GOODNIGHT, GRACIE (Cmd) set prompt 'example >>> ' -prompt - was: (Cmd) +prompt - was: (Cmd) now: example >>> example >>> say --repeat 5 spam spam @@ -33,4 +33,5 @@ spam spam spam -spam \ No newline at end of file +spam +example >>> \ No newline at end of file