lxml.doctestcompare diffs reverse the usual meaning of -expected +actual
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Low
|
Marius Gedminas |
Bug Description
Test case:
$ python2.7
>>> import doctest
>>> __test__ = dict(ex=r'''
... >>> print 'One\nTwo\nThree' # doctest: +REPORT_NDIFF
... One
... >>> import lxml.usedoctest
... >>> print '<p><span>
... <p><span>
... ''')
>>> doctest.testmod()
Now look at the diff of the first example:
***
File "__main__", line ?, in __main_
Failed example:
print 'One\nTwo\nThree' # doctest: +REPORT_NDIFF
Differences (ndiff with -expected +actual):
One
+ Two
+ Three
It uses '+' to indicate items in actual output that were not present in the expected output.
Compare with what lxml produces:
***
File "__main__", line ?, in __main_
Failed example:
print '<p><span>
Expected:
<p>
</p>
Got:
<p>
<b>Two</b>
</p>
Diff:
<p>
-<b>Two</b>
</p>
***
It uses '-' for the same purpose.
Additional info:
Python : sys.version_
lxml.etree : (3, 1, 0, 0)
libxml used : (2, 9, 0)
libxml compiled : (2, 9, 0)
libxslt used : (1, 1, 27)
libxslt compiled : (1, 1, 27)
description: | updated |
Yes, looks wrong. I'd take pull requests that fix this.