diff options
Diffstat (limited to 'Lib/test/test_coroutines.py')
-rw-r--r-- | Lib/test/test_coroutines.py | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index 2b79a17..ebd880b 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -394,20 +394,14 @@ class AsyncBadSyntaxTest(unittest.TestCase): ] for code in samples: - with self.subTest(code=code), self.assertWarnsRegex( - DeprecationWarning, - "'await' will become reserved keywords"): + with self.subTest(code=code), self.assertRaises(SyntaxError): compile(code, "<test>", "exec") def test_badsyntax_3(self): - with self.assertRaises(DeprecationWarning): - with warnings.catch_warnings(): - warnings.simplefilter("error") - compile("async = 1", "<test>", "exec") - - def test_goodsyntax_1(self): - # Tests for issue 24619 + with self.assertRaises(SyntaxError): + compile("async = 1", "<test>", "exec") + def test_badsyntax_4(self): samples = [ '''def foo(await): async def foo(): pass @@ -454,14 +448,8 @@ class AsyncBadSyntaxTest(unittest.TestCase): ] for code in samples: - with self.subTest(code=code): - loc = {} - - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - exec(code, loc, loc) - - self.assertEqual(loc['foo'](10), 11) + with self.subTest(code=code), self.assertRaises(SyntaxError): + compile(code, "<test>", "exec") class TokenizerRegrTest(unittest.TestCase): |