Skip to content

Commit a74720e

Browse files
committed
Add test case
1 parent 4bb94de commit a74720e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

mypyc/test-data/run-async.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,5 +415,26 @@ async def exc(n: int) -> list[str]:
415415
def test_exception() -> None:
416416
assert_no_leaks(lambda: exc(100), 2)
417417

418+
class C:
419+
def __init__(self, s: str) -> None:
420+
self.s = s
421+
422+
async def id(c: C) -> C:
423+
return c
424+
425+
async def stolen_helper(c: C, s: str) -> str:
426+
(await id(c)).s = await concat_one(s)
427+
return c.s
428+
429+
async def stolen(n: int) -> int:
430+
for i in range(n):
431+
c = C(str(i))
432+
s = await stolen_helper(c, str(i + 2))
433+
assert s == str(i + 2) + "1"
434+
return n
435+
436+
def test_stolen() -> None:
437+
assert_no_leaks(lambda: stolen(1000), 2)
438+
418439
[file asyncio/__init__.pyi]
419440
def run(x: object) -> object: ...

0 commit comments

Comments
 (0)