summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-03-08 11:25:48 +0100
committerChristian Heimes <christian@python.org>2021-03-08 11:30:31 +0100
commit35ebedca6fb072b25a177d5446f9a1bf176d581a (patch)
treeca05548088327a20584cb39996b250af5d31bb9e /tests.py
parent1ac00c6dcb7696b960611ebdd80964907d7d07ae (diff)
downloaddefusedxml-git-35ebedca6fb072b25a177d5446f9a1bf176d581a.tar.gz
Fix regression defusedxml.ElementTree.ParseError
The ``defusedxml.ElementTree.ParseError`` exception is now the same class object as ``xml.etree.ElementTree.ParseError`` again. The regression was introduced by new patching code as part of PR #60. See: https://github.com/tiran/defusedxml/pull/60 Fixes: https://github.com/tiran/defusedxml/issues/63 Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'tests.py')
-rw-r--r--tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index ccdf49b..ab52aab 100644
--- a/tests.py
+++ b/tests.py
@@ -218,6 +218,15 @@ class TestDefusedElementTree(BaseTests):
self.assertIs(orig_elementtree, second_elementtree)
+ def test_orig_parseerror(self):
+ # https://github.com/tiran/defusedxml/issues/63
+ self.assertIs(self.module.ParseError, orig_elementtree.ParseError)
+ try:
+ self.parseString("invalid")
+ except Exception as e:
+ self.assertIsInstance(e, orig_elementtree.ParseError)
+ self.assertIsInstance(e, self.module.ParseError)
+
class TestDefusedcElementTree(TestDefusedElementTree):
module = cElementTree