Files
codeql/python/ql/test/3/extractor-tests/async3.6/test.py
Taus 8ec414d454 Python: Add copy of internal Python 3 tests
Again, mostly extractor tests, and a single library test.
2024-04-15 12:30:01 +00:00

27 lines
615 B
Python

#PEP 525
async def ticker(delay, to):
"""Yield numbers from 0 to *to* every *delay* seconds."""
for i in range(to):
yield i
await asyncio.sleep(delay)
#PEP 530
async def f():
a = [i async for i in aiter() if i % 2]
b = [await fun() for fun in funcs if await condition()]
c = {i async for i in aiter() if i % 2}
d = {await fun() for fun in funcs if await condition()}
# Not async versions
def g():
a = [i for i in iter() if i % 2]
b = [fun() for fun in funcs if condition()]
c = {i for i in iter() if i % 2}
d = {fun() for fun in funcs if condition()}