Skip to content

Commit 076ca6c

Browse files
committed
Issue python#27369: Don’t test error message detail that changed in Expat 2.2.0
1 parent 2cdcaf1 commit 076ca6c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Lib/test/test_pyexpat.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,9 @@ def test2(self):
603603
# \xc2\x85 is UTF-8 encoded U+0085 (NEXT LINE)
604604
xml = b"<?xml version\xc2\x85='1.0'?>\r\n"
605605
parser = expat.ParserCreate()
606-
try:
606+
err_pattern = r'XML declaration not well-formed: line 1, column \d+'
607+
with self.assertRaisesRegex(expat.ExpatError, err_pattern):
607608
parser.Parse(xml, True)
608-
self.fail()
609-
except expat.ExpatError as e:
610-
self.assertEqual(str(e), 'XML declaration not well-formed: line 1, column 14')
611609

612610
class ErrorMessageTest(unittest.TestCase):
613611
def test_codes(self):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Library
2727
Tests
2828
-----
2929

30+
- Issue #27369: In test_pyexpat, avoid testing an error message detail that
31+
changed in Expat 2.2.0.
32+
3033
- Issue #25940: Changed test_ssl and test_httplib to use
3134
self-signed.pythontest.net. This avoids relying on svn.python.org, which
3235
recently changed root certificate.

0 commit comments

Comments
 (0)