Commit cc99cd70 authored by Martin Panter's avatar Martin Panter

Issue #24802: Merge ValueError test case from 3.5

parents 7861667c d61d860e
...@@ -545,10 +545,9 @@ if 1: ...@@ -545,10 +545,9 @@ if 1:
def test_null_terminated(self): def test_null_terminated(self):
# The source code is null-terminated internally, but bytes-like # The source code is null-terminated internally, but bytes-like
# objects are accepted, which could be not terminated. # objects are accepted, which could be not terminated.
# Exception changed from TypeError to ValueError in 3.5 with self.assertRaisesRegex(ValueError, "cannot contain null"):
with self.assertRaisesRegex(Exception, "cannot contain null"):
compile("123\x00", "<dummy>", "eval") compile("123\x00", "<dummy>", "eval")
with self.assertRaisesRegex(Exception, "cannot contain null"): with self.assertRaisesRegex(ValueError, "cannot contain null"):
compile(memoryview(b"123\x00"), "<dummy>", "eval") compile(memoryview(b"123\x00"), "<dummy>", "eval")
code = compile(memoryview(b"123\x00")[1:-1], "<dummy>", "eval") code = compile(memoryview(b"123\x00")[1:-1], "<dummy>", "eval")
self.assertEqual(eval(code), 23) self.assertEqual(eval(code), 23)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment