aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_xml_etree_c.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r--Lib/test/test_xml_etree_c.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index 474a4b4e182..2ff118fae88 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -1,27 +1,43 @@
# xml.etree test for cElementTree
-from test import test_support
-from test.test_support import precisionbigmemtest, _2G
+from test import support
+from test.support import bigmemtest, _2G
import unittest
-cET = test_support.import_module('xml.etree.cElementTree')
+cET = support.import_module('xml.etree.cElementTree')
# cElementTree specific tests
def sanity():
- """
+ r"""
Import sanity.
>>> from xml.etree import cElementTree
+
+ Issue #6697.
+
+ >>> 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.
- @precisionbigmemtest(size=_2G + 100, memuse=1)
+ @support.bigmemtest(size=support._2G + 100, memuse=1)
def test_length_overflow(self, size):
- if size < _2G + 100:
+ if size < support._2G + 100:
self.skipTest("not enough free memory, need at least 2 GB")
data = b'x' * size
parser = cET.XMLParser()
@@ -35,7 +51,9 @@ def test_main():
from test import test_xml_etree, test_xml_etree_c
# Run the tests specific to the C implementation
- test_support.run_doctest(test_xml_etree_c, verbosity=True)
+ support.run_doctest(test_xml_etree_c, verbosity=True)
+
+ support.run_unittest(MiscTests)
# Assign the C implementation before running the doctests
# Patch the __name__, to prevent confusion with the pure Python test