summaryrefslogtreecommitdiff
path: root/Lib/test/test_coroutines.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2017-10-05 20:24:46 -0700
committerYury Selivanov <yury@magic.io>2017-10-05 23:24:46 -0400
commitac317700ce7439e38a8b420218d9a5035bba92ed (patch)
treeddeb7d90f2e90b73a37783b88ef77376d9d996f5 /Lib/test/test_coroutines.py
parent2084b30e540d88b9fc752c5bdcc2f24334af4f2b (diff)
downloadcpython-git-ac317700ce7439e38a8b420218d9a5035bba92ed.tar.gz
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.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 2b79a17ea7..ebd880bab0 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):