diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-02-13 11:03:30 +0100 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-02-13 11:03:30 +0100 |
commit | dac572d93a0ae78bc4b1fb471c2280cdac850ddf (patch) | |
tree | 10533290d7a0571a21b18c478243d8f56f9ee77c /Lib/test/test_xml_etree_c.py | |
parent | 556f11d718386f586062e7fafa0380cc64f76951 (diff) | |
download | cpython-dac572d93a0ae78bc4b1fb471c2280cdac850ddf.tar.gz |
Issue #13988: cElementTree is deprecated and the _elementtree accelerator is automatically used whenever available.
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r-- | Lib/test/test_xml_etree_c.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 2ff118fae8..0fed7c11ff 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -1,10 +1,9 @@ # xml.etree test for cElementTree from test import support -from test.support import bigmemtest, _2G import unittest -cET = support.import_module('xml.etree.cElementTree') +from xml.etree import ElementTree as cET, cElementTree as cET_alias # cElementTree specific tests @@ -13,10 +12,9 @@ def sanity(): r""" Import sanity. - >>> from xml.etree import cElementTree - Issue #6697. + >>> cElementTree = cET >>> e = cElementTree.Element('a') >>> getattr(e, '\uD800') # doctest: +ELLIPSIS Traceback (most recent call last): @@ -55,19 +53,10 @@ def test_main(): support.run_unittest(MiscTests) - # Assign the C implementation before running the doctests - # Patch the __name__, to prevent confusion with the pure Python test - pyET = test_xml_etree.ET - py__name__ = test_xml_etree.__name__ - test_xml_etree.ET = cET - if __name__ != '__main__': - test_xml_etree.__name__ = __name__ - try: - # Run the same test suite as xml.etree.ElementTree - test_xml_etree.test_main(module_name='xml.etree.cElementTree') - finally: - test_xml_etree.ET = pyET - test_xml_etree.__name__ = py__name__ + # Run the same test suite as the Python module + test_xml_etree.test_main(module=cET) + # Exercise the deprecated alias + test_xml_etree.test_main(module=cET_alias) if __name__ == '__main__': test_main() |