summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-02-16 04:52:39 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-02-16 04:52:39 (GMT)
commitda57819efa3283a2bb86ad2629286bc5477ab0e0 (patch)
tree15b7ad4878cfeadec9634360c800752eafc9c05d /Lib/test/test_xml_etree.py
parent4aec77617f4ed29759125eecb2c04948a525d02d (diff)
downloadcpython-da57819efa3283a2bb86ad2629286bc5477ab0e0.zip
cpython-da57819efa3283a2bb86ad2629286bc5477ab0e0.tar.gz
cpython-da57819efa3283a2bb86ad2629286bc5477ab0e0.tar.bz2
in the tests of ElementTree, verify that the C accelerator is imported or not imported as expected
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index a0ee377..0d1eb22 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -1904,12 +1904,22 @@ class CleanContext(object):
self.checkwarnings.__exit__(*args)
+class TestAcceleratorNotImported(unittest.TestCase):
+ # Test that the C accelerator was not imported for pyET
+ def test_correct_import_pyET(self):
+ # In the C accelerator, Element is just a factory function, not an
+ # actual class. In the Python version it's a class.
+ self.assertIsInstance(pyET.Element, type)
+
+
def test_main(module=pyET):
from test import test_xml_etree
# The same doctests are used for both the Python and the C implementations
test_xml_etree.ET = module
+ support.run_unittest(TestAcceleratorNotImported)
+
# XXX the C module should give the same warnings as the Python module
with CleanContext(quiet=(module is not pyET)):
support.run_doctest(test_xml_etree, verbosity=True)