Mercurial > python-cmd2
diff cmd2.py @ 179:321e0cc35661
oh no... must accept prompt changes
author | catherine@Elli.myhome.westell.com |
---|---|
date | Wed, 24 Dec 2008 09:46:27 -0500 |
parents | f2b1643b5173 |
children | 951c124b0404 |
line wrap: on
line diff
--- a/cmd2.py Mon Dec 22 09:37:20 2008 -0500 +++ b/cmd2.py Wed Dec 24 09:46:27 2008 -0500 @@ -448,7 +448,7 @@ if not line: return self.emptyline() if not pyparsing.Or(self.commentGrammars).setParseAction(lambda x: '').transformString(line): - return 0 + return 0 # command was empty except for comments try: statement = self.parsed(line) while statement.parsed.multilineCommand and (statement.parsed.terminator == ''): @@ -908,13 +908,21 @@ command.append(line[len(continuationPrompt)+1:]) else: response.append(line) + def assertEqualWithWildcards(self, got, expected, message): + got = got.strip() + expected = expected.strip() + try: + self.assertEqual(got, expected, message) + except AssertionError: + print 'ooh, this is bad' + raise def testall(self): if self.CmdApp: self.divideTranscript() for (lineNum, command, expected) in self.dialogue: self.cmdapp.onecmd(command) result = self.outputTrap.read() - self.assertEqual(result.strip(), expected.strip(), + self.assertEqualWithWildcards(result, expected, '\nFile %s, line %d\nCommand was:\n%s\nExpected:\n%s\nGot:\n%s\n' % (self.transcriptFileName, lineNum, command, expected, result)) def tearDown(self):