Skip to content

Commit 0182c77

Browse files
committed
added unit test
1 parent a415319 commit 0182c77

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from asyncio import Queue
2+
3+
from rsocket.streams.helpers import async_generator_from_queue
4+
5+
6+
async def test_async_generator_from_queue():
7+
queue = Queue()
8+
9+
for i in range(10):
10+
queue.put_nowait(i)
11+
12+
queue.put_nowait(None)
13+
14+
async def collect():
15+
results = []
16+
async for i in async_generator_from_queue(queue):
17+
results.append(i)
18+
19+
return results
20+
21+
r = await collect()
22+
23+
assert r == list(range(10))

0 commit comments

Comments
 (0)