]> granicus.if.org Git - python/commitdiff
Issue #27369: Don’t test error message detail that changed in Expat 2.2.0
authorMartin Panter <vadmium+py@gmail.com>
Thu, 14 Jul 2016 01:31:46 +0000 (01:31 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Thu, 14 Jul 2016 01:31:46 +0000 (01:31 +0000)
Lib/test/test_pyexpat.py
Misc/NEWS

index eba905801c2550a1e2125f7c362d64de5b96ecb4..72840bd3128089392a2916f8f644a817ad7571a4 100644 (file)
@@ -610,11 +610,9 @@ class MalformedInputText(unittest.TestCase):
     def test2(self):
         xml = "<?xml version\xc2\x85='1.0'?>\r\n"
         parser = expat.ParserCreate()
-        try:
+        err_pattern = r'XML declaration not well-formed: line 1, column \d+'
+        with self.assertRaisesRegexp(expat.ExpatError, err_pattern):
             parser.Parse(xml, True)
-            self.fail()
-        except expat.ExpatError as e:
-            self.assertEqual(str(e), 'XML declaration not well-formed: line 1, column 14')
 
 class ForeignDTDTests(unittest.TestCase):
     """
index 1623242050540361a419c95e9f6a9f49aba220fa..9ae2221c7db11a1d0540d62374ca22860c40ff07 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -62,6 +62,12 @@ Documentation
   resulting links to use lowercase.  Patch by Sean Rodman, test by Kaushik
   Nadikuditi.
 
+Tests
+-----
+
+- Issue #27369: In test_pyexpat, avoid testing an error message detail that
+  changed in Expat 2.2.0.
+
 What's New in Python 2.7.12?
 ============================