mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-46054: Correct non-utf8 character tests in test_exceptions (GH-30074)
This commit is contained in:
parent
f4095e53ab
commit
c6d1c52c16
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue