bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro (GH-21363)

This commit is contained in:
Pablo Galindo 2020-07-06 23:30:14 +01:00 committed by GitHub
parent bd46174a5a
commit c2c1f1f906
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -372,12 +372,14 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(rv, tuple(expected)) self.assertEqual(rv, tuple(expected))
def test_compile_top_level_await_no_coro(self): def test_compile_top_level_await_no_coro(self):
"""Make sure top level non-await codes get the correct coroutine flags. """Make sure top level non-await codes get the correct coroutine flags"""
"""
modes = ('single', 'exec') modes = ('single', 'exec')
code_samples = [ code_samples = [
'''def f():pass\n''', '''def f():pass\n''',
'''[x for x in l]''' '''[x for x in l]''',
'''{x for x in l}''',
'''(x for x in l)''',
'''{x:x for x in l}''',
] ]
for mode, code_sample in product(modes, code_samples): for mode, code_sample in product(modes, code_samples):
source = dedent(code_sample) source = dedent(code_sample)