summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-12-12 16:53:00 (GMT)
committerGitHub <noreply@github.com>2021-12-12 16:53:00 (GMT)
commitc6d1c52c166968fb722ae26d44aa2c1c030dc613 (patch)
tree102531a9bc4e260f8bb0354c55e4e560fd6bd870 /Lib
parentf4095e53ab708d95e019c909d5928502775ba68f (diff)
downloadcpython-c6d1c52c166968fb722ae26d44aa2c1c030dc613.zip
cpython-c6d1c52c166968fb722ae26d44aa2c1c030dc613.tar.gz
cpython-c6d1c52c166968fb722ae26d44aa2c1c030dc613.tar.bz2
bpo-46054: Correct non-utf8 character tests in test_exceptions (GH-30074)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_exceptions.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 1021026..ffcb5e1 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)