Fix test failure with newer Expat:
https://bugs.python.org/issue46811
This is a backport of this upstream commit:
https://github.com/python/cpython/commit/2cae93832f46b245847bdc252456ddf7742ef45e
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 2eb642395b..1793f9365d 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -6,12 +6,14 @@ from StringIO import StringIO
from test import support
import unittest
+import pyexpat
import xml.dom
import xml.dom.minidom
import xml.parsers.expat
from xml.dom.minidom import parse, Node, Document, parseString
from xml.dom.minidom import getDOMImplementation
+from xml.parsers.expat import ExpatError
tstfile = support.findfile("test.xml", subdir="xmltestdata")
@@ -1051,7 +1053,13 @@ class MinidomTest(unittest.TestCase):
# Verify that character decoding errors raise exceptions instead
# of crashing
- self.assertRaises(UnicodeDecodeError, parseString,
+ if pyexpat.version_info >= (2, 4, 5):
+ self.assertRaises(ExpatError, parseString,
+ b'