diff options
author | Ned Deily <nad@acm.org> | 2014-03-27 23:39:58 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2014-03-27 23:39:58 (GMT) |
commit | e7d532fbc9c13e00b1e5c6c0db2dba31d1212de7 (patch) | |
tree | 2bd2f23bfd2bcc454c47ff4dfad438b2e9114af1 /Lib/test/test_pyexpat.py | |
parent | 2542b66bb04e5634410205f54523987dce9e5bf7 (diff) | |
download | cpython-e7d532fbc9c13e00b1e5c6c0db2dba31d1212de7.zip cpython-e7d532fbc9c13e00b1e5c6c0db2dba31d1212de7.tar.gz cpython-e7d532fbc9c13e00b1e5c6c0db2dba31d1212de7.tar.bz2 |
Issue #6676: Ensure a meaningful exception is raised when attempting
to parse more than one XML document per pyexpat xmlparser instance.
(Original patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with
suggested wording by David Gutteridge)
Diffstat (limited to 'Lib/test/test_pyexpat.py')
-rw-r--r-- | Lib/test/test_pyexpat.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py index 8ef3917..95a614b 100644 --- a/Lib/test/test_pyexpat.py +++ b/Lib/test/test_pyexpat.py @@ -236,6 +236,18 @@ class ParseTest(unittest.TestCase): operations = out.out self._verify_parse_output(operations) + def test_parse_again(self): + parser = expat.ParserCreate() + file = BytesIO(data) + parser.ParseFile(file) + # Issue 6676: ensure a meaningful exception is raised when attempting + # to parse more than one XML document per xmlparser instance, + # a limitation of the Expat library. + with self.assertRaises(expat.error) as cm: + parser.ParseFile(file) + self.assertEqual(expat.ErrorString(cm.exception.code), + expat.errors.XML_ERROR_FINISHED) + class NamespaceSeparatorTest(unittest.TestCase): def test_legal(self): # Tests that make sure we get errors when the namespace_separator value |