diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2017-10-06 03:24:46 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2017-10-06 03:24:46 (GMT) |
commit | ac317700ce7439e38a8b420218d9a5035bba92ed (patch) | |
tree | ddeb7d90f2e90b73a37783b88ef77376d9d996f5 /Lib/test/test_coroutines.py | |
parent | 2084b30e540d88b9fc752c5bdcc2f24334af4f2b (diff) | |
download | cpython-ac317700ce7439e38a8b420218d9a5035bba92ed.zip cpython-ac317700ce7439e38a8b420218d9a5035bba92ed.tar.gz cpython-ac317700ce7439e38a8b420218d9a5035bba92ed.tar.bz2 |
bpo-30406: Make async and await proper keywords (#1669)
Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
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): |