summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree_c.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-06-15 04:42:50 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-06-15 04:42:50 (GMT)
commit64d11e60f23f6b1435704adb87ebf818e5a4c0c1 (patch)
treeece3c4337e34bdb0408016b1eb38428343b75873 /Lib/test/test_xml_etree_c.py
parentfedb04a37aff9f7a2cfe746f7fc4683e74e38bf0 (diff)
downloadcpython-64d11e60f23f6b1435704adb87ebf818e5a4c0c1.zip
cpython-64d11e60f23f6b1435704adb87ebf818e5a4c0c1.tar.gz
cpython-64d11e60f23f6b1435704adb87ebf818e5a4c0c1.tar.bz2
Replace the iter/itertext methods of Element in _elementtree with true C implementations, instead of the bootstrapped Python code. In addition to being cleaner (removing the last remains of the bootstrapping code in _elementtree), this gives a 10x performance boost for iter() on large documents.
Also reorganized the tests a bit to be more robust.
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r--Lib/test/test_xml_etree_c.py28
1 files changed, 2 insertions, 26 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index 10416d2..142a22f 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -8,31 +8,6 @@ cET = import_fresh_module('xml.etree.ElementTree', fresh=['_elementtree'])
cET_alias = import_fresh_module('xml.etree.cElementTree', fresh=['_elementtree', 'xml.etree'])
-# cElementTree specific tests
-
-def sanity():
- r"""
- Import sanity.
-
- Issue #6697.
-
- >>> cElementTree = cET
- >>> e = cElementTree.Element('a')
- >>> getattr(e, '\uD800') # doctest: +ELLIPSIS
- Traceback (most recent call last):
- ...
- UnicodeEncodeError: ...
-
- >>> p = cElementTree.XMLParser()
- >>> p.version.split()[0]
- 'Expat'
- >>> getattr(p, '\uD800')
- Traceback (most recent call last):
- ...
- AttributeError: 'XMLParser' object has no attribute '\ud800'
- """
-
-
class MiscTests(unittest.TestCase):
# Issue #8651.
@support.bigmemtest(size=support._2G + 100, memuse=1)
@@ -46,6 +21,7 @@ class MiscTests(unittest.TestCase):
finally:
data = None
+
@unittest.skipUnless(cET, 'requires _elementtree')
class TestAliasWorking(unittest.TestCase):
# Test that the cET alias module is alive
@@ -53,6 +29,7 @@ class TestAliasWorking(unittest.TestCase):
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
@@ -67,7 +44,6 @@ def test_main():
from test import test_xml_etree, test_xml_etree_c
# Run the tests specific to the C implementation
- support.run_doctest(test_xml_etree_c, verbosity=True)
support.run_unittest(
MiscTests,
TestAliasWorking,