summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree_c.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_c.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_c.py')
-rw-r--r--Lib/test/test_xml_etree_c.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index 6f62009..a0fcb83 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -46,6 +46,16 @@ class MiscTests(unittest.TestCase):
finally:
data = None
+class TestAcceleratorImported(unittest.TestCase):
+ # Test that the C accelerator was imported, as expected
+ def test_correct_import_cET(self):
+ # In the C accelerator, Element is just a factory function, not an
+ # actual class. In the Python version it's a class.
+ self.assertNotIsInstance(cET.Element, type)
+
+ def test_correct_import_cET_alias(self):
+ self.assertNotIsInstance(cET_alias.Element, type)
+
def test_main():
from test import test_xml_etree, test_xml_etree_c
@@ -53,7 +63,7 @@ def test_main():
# Run the tests specific to the C implementation
support.run_doctest(test_xml_etree_c, verbosity=True)
- support.run_unittest(MiscTests)
+ support.run_unittest(MiscTests, TestAcceleratorImported)
# Run the same test suite as the Python module
test_xml_etree.test_main(module=cET)