MCPcopy Index your code
hub / github.com/RustPython/RustPython / run_sync

Function run_sync

extra_tests/snippets/syntax_async_comprehension.py:145–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143
144
145def run_sync():
146 async def test_async_for(x):
147 i = 0
148 async for e in x:
149 assert e == i
150 i += 1
151
152 x = (i for i in range(5))
153 assert isinstance(x, GeneratorType)
154 for i, e in enumerate(x):
155 assert e == i
156
157 x = (await f_async(i) for i in range(5))
158 assert isinstance(x, AsyncGeneratorType)
159 asyncio.run(test_async_for(x), debug=True)
160
161 x = (e async for e in f_aiter())
162 assert isinstance(x, AsyncGeneratorType)
163 asyncio.run(test_async_for(x), debug=True)
164
165 x = (await f_async(i) async for i in f_aiter())
166 assert isinstance(x, AsyncGeneratorType)
167 asyncio.run(test_async_for(x), debug=True)
168
169
170asyncio.run(run_async(), debug=True)

Callers 1

Calls 6

isinstanceFunction · 0.85
enumerateFunction · 0.85
f_asyncFunction · 0.85
f_aiterFunction · 0.85
test_async_forFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected