Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Uncomment async for tests
  • Loading branch information
youknowone committed Apr 25, 2024
commit b58bdc9e328f7e34b21bdd5f6b82b3c7f9836da6
46 changes: 23 additions & 23 deletions Lib/test/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,16 +513,15 @@ def __anext__(self):
return self.yielded
self.check_async_iterator_anext(MyAsyncIterWithTypesCoro)

# TODO: RUSTPYTHON: async for gen expression compilation
# def test_async_gen_aiter(self):
# async def gen():
# yield 1
# yield 2
# g = gen()
# async def consume():
# return [i async for i in aiter(g)]
# res = self.loop.run_until_complete(consume())
# self.assertEqual(res, [1, 2])
def test_async_gen_aiter(self):
async def gen():
yield 1
yield 2
g = gen()
async def consume():
return [i async for i in aiter(g)]
res = self.loop.run_until_complete(consume())
self.assertEqual(res, [1, 2])

# TODO: RUSTPYTHON, NameError: name 'aiter' is not defined
@unittest.expectedFailure
Expand Down Expand Up @@ -1569,22 +1568,23 @@ async def main():
self.assertIn('unhandled exception during asyncio.run() shutdown',
message['message'])

# TODO: RUSTPYTHON: async for gen expression compilation
# def test_async_gen_expression_01(self):
# async def arange(n):
# for i in range(n):
# await asyncio.sleep(0.01)
# yield i
# TODO: RUSTPYTHON; TypeError: object async_generator can't be used in 'await' expression
@unittest.expectedFailure
def test_async_gen_expression_01(self):
async def arange(n):
for i in range(n):
await asyncio.sleep(0.01)
yield i

# def make_arange(n):
# # This syntax is legal starting with Python 3.7
# return (i * 2 async for i in arange(n))
def make_arange(n):
# This syntax is legal starting with Python 3.7
return (i * 2 async for i in arange(n))

# async def run():
# return [i async for i in make_arange(10)]
async def run():
return [i async for i in make_arange(10)]

# res = self.loop.run_until_complete(run())
# self.assertEqual(res, [i * 2 for i in range(10)])
res = self.loop.run_until_complete(run())
self.assertEqual(res, [i * 2 for i in range(10)])

# TODO: RUSTPYTHON: async for gen expression compilation
# def test_async_gen_expression_02(self):
Expand Down