Issue1019220
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2004-08-30 17:00 by felixwiemann, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
unittest.py.patch-2 | felixwiemann, 2004-09-12 17:15 | Patch for unittest.py with bugfix |
Messages (6) | |||
---|---|---|---|
msg46809 - (view) | Author: Felix Wiemann (felixwiemann) | Date: 2004-08-30 17:00 | |
Currently, the output of unittest.py looks like this: F ====================================================================== FAIL: test_newline (__main__.NewlineTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "unittestnewline.py", line 7, in test_newline self.assertEqual('foo\nbar\nbaz', 'foo\nbaz\nbaz') AssertionError: 'foo\nbar\nbaz' != 'foo\nbaz\nbaz' ---------------------------------------------------------------------- Ran 1 test in 0.001s FAILED (failures=1) For long strings to be compared, an output like 'foo\nbar\nbaz' != 'foo\nbaz\nbaz' isn't particularly useful. The attached patch makes it look like this for multi-line strings: F ====================================================================== FAIL: test_newline (__main__.NewlineTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "unittestnewline.py", line 7, in test_newline self.assertEqual('foo\nbar\nbaz', 'foo\nbaz\nbaz') AssertionError: '''foo bar baz''' != '''foo baz baz''' ---------------------------------------------------------------------- Ran 1 test in 0.001s FAILED (failures=1) The behavior is only changed for strings which contain newline characters. I admittedly do not know if there is a problem when using the patched unittest.py on Windows (due to the different newline convention). |
|||
msg46810 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2004-09-07 05:08 | |
Logged In: YES user_id=80475 Steve, would you rule on this one? I personally do not find it to be an improvement. Walter Dörwald is also a heavy unittester and may have a helpful viewpoint. |
|||
msg46811 - (view) | Author: Steve Purcell (purcell) | Date: 2004-09-07 15:54 | |
Logged In: YES user_id=21477 Hi Raymond and Felix, I also don't find this an improvement. I personally like to see the repr() version of the strings, since it shows embedded tabs etc; the output proposed here makes such differences much less obvious. More interesting was a patch submitted some time ago that used difflib to show the exact differing areas between the unequal strings. I was wary of that patch due to the amount of extra code it introduced, and an incompatibility with Jython at the time, IIRC. |
|||
msg46812 - (view) | Author: Felix Wiemann (felixwiemann) | Date: 2004-09-07 17:21 | |
Logged In: YES user_id=1014490 > I personally like to see the repr() > version of the strings, since it shows embedded tabs etc; The patch doesn't change that. It just replaces \n by real newlines. The reason why I wrote this patch is that the Docutils unit tests often contain very many lines of text, and if something has changed, it is very handy to be able to copy some lines of test output into the test files. But this only works if the lines contain real newlines -- the long character sequences with some intermittent '\n's unittest.py currently produces are almost unusable. If I've been able convince you, feel free to re-open the bug. :-) |
|||
msg46813 - (view) | Author: Felix Wiemann (felixwiemann) | Date: 2004-09-12 17:15 | |
Logged In: YES user_id=1014490 Just in case anyone wants to use the patch: There is a bug in the patch, which pops up when using unicode strings. I uploaded a fixed version. The patch is against unittest.py rev. 1.63, as included in Python2.4a3. |
|||
msg46814 - (view) | Author: Felix Wiemann (felixwiemann) | Date: 2004-09-13 18:35 | |
Logged In: YES user_id=1014490 If anyone finds this tracker item later and wants to use the patch, please refer to CustomTestCase and _format_str in DocutilsTestSupport.py instead: http://cvs.sourceforge.net/viewcvs.py/docutils/docutils/test/DocutilsTestSupport.py The patch in this tracker item still has bugs which are fixed in the above mentioned file. (Sorry for causing lots of mail traffic.) |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:06 | admin | set | github: 40846 |
2004-08-30 17:00:01 | felixwiemann | create |