summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree_c.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-03-04 05:14:03 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-03-04 05:14:03 (GMT)
commit092af1fc5cd1b314143ee848025008c4ed862285 (patch)
tree4cde4a2aee2ba401515f7185c1ffbedf41a035b6 /Lib/test/test_xml_etree_c.py
parentc9590ad745caa9fc76a8373d19e8019d90e8f9e8 (diff)
downloadcpython-092af1fc5cd1b314143ee848025008c4ed862285.zip
cpython-092af1fc5cd1b314143ee848025008c4ed862285.tar.gz
cpython-092af1fc5cd1b314143ee848025008c4ed862285.tar.bz2
Issue #14128: Exposing Element as an actual type from _elementtree, rather than a factory function.
This makes the C implementation more aligned with the Python implementation. Also added some tests to ensure that Element is now a type and that it can be subclassed.
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r--Lib/test/test_xml_etree_c.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index a73d0c4..cfd18ee 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -47,13 +47,21 @@ class MiscTests(unittest.TestCase):
data = None
@unittest.skipUnless(cET, 'requires _elementtree')
+class TestAliasWorking(unittest.TestCase):
+ # Test that the cET alias module is alive
+ def test_alias_working(self):
+ e = cET_alias.Element('foo')
+ self.assertEqual(e.tag, 'foo')
+
+
+@unittest.skipUnless(cET, 'requires _elementtree')
class TestAcceleratorImported(unittest.TestCase):
# Test that the C accelerator was imported, as expected
def test_correct_import_cET(self):
- self.assertEqual(cET.Element.__module__, '_elementtree')
+ self.assertEqual(cET.SubElement.__module__, '_elementtree')
def test_correct_import_cET_alias(self):
- self.assertEqual(cET_alias.Element.__module__, '_elementtree')
+ self.assertEqual(cET_alias.SubElement.__module__, '_elementtree')
def test_main():
@@ -61,13 +69,15 @@ def test_main():
# Run the tests specific to the C implementation
support.run_doctest(test_xml_etree_c, verbosity=True)
-
- support.run_unittest(MiscTests, TestAcceleratorImported)
+ support.run_unittest(
+ MiscTests,
+ TestAliasWorking,
+ TestAcceleratorImported
+ )
# 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()