Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d61d860

Browse files
committed
Issue #24802: Update test case for ValueError in 3.5
1 parent b0deeb4 commit d61d860

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Lib/test/test_compile.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,9 @@ def check_limit(prefix, repeated):
545545
def test_null_terminated(self):
546546
# The source code is null-terminated internally, but bytes-like
547547
# objects are accepted, which could be not terminated.
548-
# Exception changed from TypeError to ValueError in 3.5
549-
with self.assertRaisesRegex(Exception, "cannot contain null"):
548+
with self.assertRaisesRegex(ValueError, "cannot contain null"):
550549
compile("123\x00", "<dummy>", "eval")
551-
with self.assertRaisesRegex(Exception, "cannot contain null"):
550+
with self.assertRaisesRegex(ValueError, "cannot contain null"):
552551
compile(memoryview(b"123\x00"), "<dummy>", "eval")
553552
code = compile(memoryview(b"123\x00")[1:-1], "<dummy>", "eval")
554553
self.assertEqual(eval(code), 23)

0 commit comments

Comments
 (0)