Datasets:
Download Python/val/3.13/async-generators/modern_01.py from SwashBuckler001/idiombench: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/val/3.13/async-generators/modern_01.py
- Command line
-
hf download hf://datasets/SwashBuckler001/idiombench/Python/val/3.13/async-generators/modern_01.py
-
curl -L -o modern_01.py https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/val/3.13/async-generators/modern_01.py
1.46 kB
| import inspect | |
| import types | |
| import unittest | |
| import contextlib | |
| from test.support.import_helper import import_module | |
| from test.support import gc_collect, requires_working_socket | |
| class AsyncGenSyntaxTest(unittest.TestCase): | |
| def test_async_gen_syntax_01(self): | |
| code = '''async def foo(): | |
| await abc | |
| yield from 123 | |
| ''' | |
| with self.assertRaisesRegex(SyntaxError, 'yield from.*inside async'): | |
| exec(code, {}, {}) | |
| def test_async_gen_syntax_02(self): | |
| code = '''async def foo(): | |
| yield from 123 | |
| ''' | |
| with self.assertRaisesRegex(SyntaxError, 'yield from.*inside async'): | |
| exec(code, {}, {}) | |
| def test_async_gen_syntax_03(self): | |
| code = '''async def foo(): | |
| await abc | |
| yield | |
| return 123 | |
| ''' | |
| with self.assertRaisesRegex(SyntaxError, 'return.*value.*async gen'): | |
| exec(code, {}, {}) | |
| def test_async_gen_syntax_04(self): | |
| code = '''async def foo(): | |
| yield | |
| return 123 | |
| ''' | |
| with self.assertRaisesRegex(SyntaxError, 'return.*value.*async gen'): | |
| exec(code, {}, {}) | |
| def test_async_gen_syntax_05(self): | |
| code = '''async def foo(): | |
| if 0: | |
| yield | |
| return 12 | |
| ''' | |
| with self.assertRaisesRegex(SyntaxError, 'return.*value.*async gen'): | |
| exec(code, {}, {}) | |