From acc4ac5aec1b0389afa8e40f6313832190ecf220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Fri, 20 May 2022 17:48:51 +0200 Subject: [PATCH] Fix for the compatibility problems with expat started in 2.4.4, not just 2.4.5. --- Lib/test/test_minidom.py | 13 ++++++------- .../2022-05-20-17-48-38.gh-issue-93018.SeUVAH.rst | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2022-05-20-17-48-38.gh-issue-93018.SeUVAH.rst diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 97620258d82f6b..8b9de659fd09c1 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -6,12 +6,11 @@ from test import support import unittest -import pyexpat +import xml.parsers.expat import xml.dom.minidom 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") @@ -1149,10 +1148,10 @@ def testEncodings(self): # Verify that character decoding errors raise exceptions instead # of crashing - if pyexpat.version_info >= (2, 4, 5): - self.assertRaises(ExpatError, parseString, + if xml.parsers.expat.version_info >= (2, 4, 4): + self.assertRaises(xml.parsers.expat.ExpatError, parseString, b'') - self.assertRaises(ExpatError, parseString, + self.assertRaises(xml.parsers.expat.ExpatError, parseString, b'Comment \xe7a va ? Tr\xe8s bien ?') else: self.assertRaises(UnicodeDecodeError, parseString, @@ -1617,8 +1616,8 @@ def testEmptyXMLNSValue(self): self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE) def testExceptionOnSpacesInXMLNSValue(self): - if pyexpat.version_info >= (2, 4, 5): - context = self.assertRaisesRegex(ExpatError, 'syntax error') + if xml.parsers.expat.version_info >= (2, 4, 4): + context = self.assertRaisesRegex(xml.parsers.expat.ExpatError, 'syntax error') else: context = self.assertRaisesRegex(ValueError, 'Unsupported syntax') diff --git a/Misc/NEWS.d/next/Tests/2022-05-20-17-48-38.gh-issue-93018.SeUVAH.rst b/Misc/NEWS.d/next/Tests/2022-05-20-17-48-38.gh-issue-93018.SeUVAH.rst new file mode 100644 index 00000000000000..05f1c87d3878c3 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-05-20-17-48-38.gh-issue-93018.SeUVAH.rst @@ -0,0 +1 @@ +Fix for the compatibility problems with expat started in 2.4.4, not just 2.4.5