Skip to content

Commit c29df65

Browse files
committed
Issue python#27369: Merge test_pyexpat from 3.4 into 3.5
2 parents 945863a + b7b5d35 commit c29df65

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Lib/test/test_pyexpat.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,9 @@ def test2(self):
656656
# \xc2\x85 is UTF-8 encoded U+0085 (NEXT LINE)
657657
xml = b"<?xml version\xc2\x85='1.0'?>\r\n"
658658
parser = expat.ParserCreate()
659-
try:
659+
err_pattern = r'XML declaration not well-formed: line 1, column \d+'
660+
with self.assertRaisesRegex(expat.ExpatError, err_pattern):
660661
parser.Parse(xml, True)
661-
self.fail()
662-
except expat.ExpatError as e:
663-
self.assertEqual(str(e), 'XML declaration not well-formed: line 1, column 14')
664662

665663
class ErrorMessageTest(unittest.TestCase):
666664
def test_codes(self):

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ C API
9090
- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
9191
an iterable of integers. Now only strings and bytes-like objects are accepted.
9292

93+
Tests
94+
-----
95+
96+
- Issue #27369: In test_pyexpat, avoid testing an error message detail that
97+
changed in Expat 2.2.0.
98+
9399
Tools/Demos
94100
-----------
95101

0 commit comments

Comments
 (0)