diff cmd2/cmd2.py @ 107:3e2651cbe376

vigorous whitespace stripping from test results
author catherine@dellzilla
date Fri, 24 Oct 2008 16:13:47 -0400
parents 2d3232693807
children f7b0152c57f9
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()