File tree Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 11# async test cases (compile and run)
22
3- [case testAsync ]
3+ [case testRunAsync ]
44import asyncio
55
66async def h() -> int:
@@ -11,19 +11,29 @@ async def g() -> int:
1111 return await h()
1212
1313async def f() -> int:
14- return await g()
14+ return await g() + 2
15+
16+ async def f2() -> int:
17+ x = 0
18+ for i in range(2):
19+ x += i + await f() + await g()
20+ return x
21+
22+ def test_1() -> None:
23+ result = asyncio.run(f())
24+ assert result == 3
25+
26+ def test_2() -> None:
27+ result = asyncio.run(f2())
28+ assert result == 9
1529
1630[file asyncio/__init__.pyi]
1731async def sleep(t: float) -> None: ...
32+ # eh, we could use the real type but it doesn't seem important
33+ def run(x: object) -> object: ...
1834
1935[typing fixtures/typing-full.pyi]
2036
21- [file driver.py]
22- from native import f
23- import asyncio
24-
25- result = asyncio.run(f())
26- assert result == 1
2737
2838[case testAsyncWith]
2939from testutil import async_val
Original file line number Diff line number Diff line change @@ -683,17 +683,16 @@ def test_basic() -> None:
683683
684684[case testYieldSpill]
685685from typing import Generator
686+ from testutil import run_generator
686687
687688def f() -> int:
688689 return 1
689690
690691def yield_spill() -> Generator[str, int, int]:
691692 return f() + (yield "foo")
692693
693- [file driver.py]
694- from native import yield_spill
695- from testutil import run_generator
696-
697- yields, val = run_generator(yield_spill(), [2])
698- assert yields == ('foo',)
699- assert val == 3, val
694+ def test_basic() -> None:
695+ x = run_generator(yield_spill(), [2])
696+ yields, val = x
697+ assert yields == ('foo',)
698+ assert val == 3, val
You can’t perform that action at this time.
0 commit comments