Skip to content

Commit 89a31e9

Browse files
committed
Issue #27369: Merge test_pyexpat from 3.2 into 3.3
2 parents 7453c5f + cbdb779 commit 89a31e9

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
@@ -60,6 +60,9 @@ C API
6060
Tests
6161
-----
6262

63+
- Issue #27369: In test_pyexpat, avoid testing an error message detail that
64+
changed in Expat 2.2.0.
65+
6366
- Issue #25940: Changed test_ssl and test_httplib to use
6467
self-signed.pythontest.net. This avoids relying on svn.python.org, which
6568
recently changed root certificate.

0 commit comments

Comments
 (0)