diff options
Diffstat (limited to 'Lib/test/test_compiler_codegen.py')
-rw-r--r-- | Lib/test/test_compiler_codegen.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_compiler_codegen.py b/Lib/test/test_compiler_codegen.py index d82fb85ed25..8a15c400a44 100644 --- a/Lib/test/test_compiler_codegen.py +++ b/Lib/test/test_compiler_codegen.py @@ -152,5 +152,8 @@ class IsolatedCodeGenTests(CodegenTestCase): def test_syntax_error__return_not_in_function(self): snippet = "return 42" - with self.assertRaisesRegex(SyntaxError, "'return' outside function"): + with self.assertRaisesRegex(SyntaxError, "'return' outside function") as cm: self.codegen_test(snippet, None) + self.assertIsNone(cm.exception.text) + self.assertEqual(cm.exception.offset, 1) + self.assertEqual(cm.exception.end_offset, 10) |