diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-02-13 10:03:30 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-02-13 10:03:30 (GMT) |
commit | a72a98f24a19928e31dcc4cab2cd2ad0f1846e11 (patch) | |
tree | ad529c9dde015c31cd942875a78de8e6eb52da58 /Lib/test/test_xml_etree_c.py | |
parent | d1c7b1afe8eb49bc7ef3bbcae391e763c695d195 (diff) | |
download | cpython-a72a98f24a19928e31dcc4cab2cd2ad0f1846e11.zip cpython-a72a98f24a19928e31dcc4cab2cd2ad0f1846e11.tar.gz cpython-a72a98f24a19928e31dcc4cab2cd2ad0f1846e11.tar.bz2 |
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 2ff118f..0fed7c1 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() |