diff options
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r-- | Lib/test/test_xml_etree_c.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 5c0bf6c..db69e5f 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -1,6 +1,8 @@ # xml.etree test for cElementTree from test import support +from test.support import precisionbigmemtest, _2G +import unittest cET = support.import_module('xml.etree.cElementTree') @@ -31,12 +33,28 @@ def sanity(): """ +class MiscTests(unittest.TestCase): + # Issue #8651. + @support.precisionbigmemtest(size=support._2G + 100, memuse=1) + def test_length_overflow(self, size): + if size < support._2G + 100: + self.skipTest("not enough free memory, need at least 2 GB") + data = b'x' * size + parser = cET.XMLParser() + try: + self.assertRaises(OverflowError, parser.feed, data) + finally: + data = None + + 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) + # Assign the C implementation before running the doctests # Patch the __name__, to prevent confusion with the pure Python test pyET = test_xml_etree.ET |