From: Pablo Galindo Salgado Date: Sun, 12 Dec 2021 16:53:00 +0000 (+0000) Subject: bpo-46054: Correct non-utf8 character tests in test_exceptions (GH-30074) X-Git-Tag: v3.11.0a4~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c6d1c52c166968fb722ae26d44aa2c1c030dc613;p=thirdparty%2FPython%2Fcpython.git bpo-46054: Correct non-utf8 character tests in test_exceptions (GH-30074) --- diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 102102669db1..ffcb5e1ff5ad 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -2391,11 +2391,11 @@ class SyntaxErrorTests(unittest.TestCase): # Check non utf-8 characters try: with open(TESTFN, 'bw') as testfile: - testfile.write(b'\x7fELF\x02\x01\x01\x00\x00\x00') + testfile.write(b"\x89") rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN) err = err.decode('utf-8').splitlines() - self.assertEqual(err[-1], "SyntaxError: invalid non-printable character U+007F") + self.assertIn("SyntaxError: Non-UTF-8 code starting with '\\x89' in file", err[-1]) finally: unlink(TESTFN)