[Imps] Patch to convert test_parser to unittest

Sam Ruby rubys at intertwingly.net
Thu Dec 14 09:23:13 PST 2006


James Graham wrote:
> Sam Ruby wrote:
>> Two attachments: one to convert the existing test_parser.py to use 
>> unittset (this patch also includes some minor cleanup to 
>> test_tokenizer); and the other is a master script to run all tests 
>> (place this script in the tests directory).
> 
> Sam, just reading the patch it seems that, when a test fails, this will 
> just print the test number and the input that failed. However, for the 
> purposes of debugging it has been very useful to have both the expected 
> and actual parse tree printed when running the tests (similarly with the 
> token lists in the tokenizer tests). It this easy to change? I tried 
> with the tokenizer test cases but couldn't quite see where the right 
> place to inject the actual output into the error message would be. Am I 
> missing something obvious? If this issue can't be resolved, I'm quite 
> reluctant to apply the patch because it seems to regress useful 
> functionality.

The default message produced by UnitTest.assertEqual includes 
representations for both the expected and actual parse trees.  If the 
formatting is an issue, a third parameter can be passed to assertEqual 
that contains the exact message you would like to be produced in case of 
failure.

- Sam Ruby





More information about the Implementors mailing list