[Python-Dev] Update xml.etree.ElementTree for Python 2.7 and 3.2

Florent Xicluna florent.xicluna at gmail.com
Sat Feb 20 11:53:29 CET 2010


Stefan Behnel <stefan_ml <at> behnel.de> writes:

> 
> Florent Xicluna, 18.02.2010 10:21:
> > For this purpose, I grew the test suite from 300 lines to 1800 lines,
> > using both the tests from upstream and the tests proposed by Neil Muller
> > on issue #6232.
> 
> Just a comment on this. While the new tests may work with ElementTree as
> is, there are a couple of problem with them. They become apparent when
> running the test suite against lxml.etree.
> 

The test suite in the stdlib targets the "xml.etree" implementations only.

> None of theses features is really required to hold for anything but the
> current as-is implementation.
> 

I agree.

> So my impression is that many of the tests try to provide guarantees where
> they cannot or should not exist, and even where the output is clearly
> non-conforming with respect to standards. I don't think it makes sense to
> put these into a regression test suite.
> 

The test suite in the stdlib should try to cover every piece of code, even
implementation details and edge cases. It guarantees that the implementation
details do not change between minor releases. And it helps identify regression
or evolution of the behavior when the library is updated.
However we may identify better each category of tests:
 - tests for the ElementTree API 1.2, which should pass with lxml.etree, too.
 - tests of implementation details, which are not part of the specification.

Additionally, these tests ensure that the C implementation can be used as a
drop-in replacement of the Python implementation. It is a request expressed by
many users of the "xml.etree" package.

> That said, I should add that lxml's test suite includes about 250 unit
> tests that work with (and adapt to) lxml.etree, ElementTree and
> cElementTree, in Py2.3+ and Py3.x, and with ET 1.2 and ET 1.3. Although
> certainly not a copy&run replacement, those should be much better suited to
> accompany the existing stdlib tests.
> 

Interesting. I may add these tests to the test_suite, if they are not
completely redundant.

--
Florent Xicluna




More information about the Python-Dev mailing list