summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-06-30 16:49:04 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-06-30 16:49:04 (GMT)
commit9dec03571f2ec588dfc15ff438c85fe25989dcc1 (patch)
tree2bcbc27c1b90c7ea549a24d99ad2ca1a9c514012 /Lib/test
parent4a01cab89894b157f282b2032862a278c9edb842 (diff)
downloadcpython-9dec03571f2ec588dfc15ff438c85fe25989dcc1.zip
cpython-9dec03571f2ec588dfc15ff438c85fe25989dcc1.tar.gz
cpython-9dec03571f2ec588dfc15ff438c85fe25989dcc1.tar.bz2
Issue #24528: Improve error message for awaits in comprehensions
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_coroutines.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 8d2b1a3..e869fd2 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -106,6 +106,16 @@ class AsyncBadSyntaxTest(unittest.TestCase):
with self.assertRaisesRegex(SyntaxError, 'invalid syntax'):
import test.badsyntax_async9
+ def test_badsyntax_10(self):
+ ns = {}
+ for comp in {'(await a for a in b)',
+ '[await a for a in b]',
+ '{await a for a in b}',
+ '{await a: c for a in b}'}:
+
+ with self.assertRaisesRegex( SyntaxError, 'await.*in comprehen'):
+ exec('async def f():\n\t{}'.format(comp), ns, ns)
+
class TokenizerRegrTest(unittest.TestCase):