Comment 0 for bug 1238503

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Test case:

    $ python2.7
    >>> import doctest
    >>> __test__ = dict(ex=r'''
    >>> print 'One\nTwo\nThree' # doctest: +REPORT_NDIFF
    One
    >>> import lxml.usedoctest
    >>> print '<p><span>One</span><b>Two</b><em>Three</em></p>'
    <p><span>One</span></p>
    ''')
    >>> doctest.testmod()

Now look at the diff of the first example:

    **********************************************************************
    File "__main__", line ?, in __main__.__test__.ex
    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__.__test__.ex
    Failed example:
        print '<p><span>One</span><b>Two</b><em>Three</em></p>'
    Expected:
      <p>
        <span>One</span>
      </p>

    Got:
      <p>
        <span>One</span>
        <b>Two</b>
        <em>Three</em>
      </p>

    Diff:
      <p>
        <span>One</span>
        -<b>Two</b>
        -<em>Three</em>
      </p>
    **********************************************************************

It uses '-' for the same purpose.

Additional info:

Python : sys.version_info(major=2, minor=7, micro=4, releaselevel='final', serial=0)
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)