Skip to content

Commit bfa7281

Browse files
committed
make it a no driver test
1 parent 66084cc commit bfa7281

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

mypyc/test-data/run-async.test

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# async test cases (compile and run)
22

3-
[case testAsync]
3+
[case testRunAsync]
44
import asyncio
55

66
async def h() -> int:
@@ -11,19 +11,29 @@ async def g() -> int:
1111
return await h()
1212

1313
async 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]
1731
async 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]
2939
from testutil import async_val

mypyc/test-data/run-generators.test

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,17 +683,16 @@ def test_basic() -> None:
683683

684684
[case testYieldSpill]
685685
from typing import Generator
686+
from testutil import run_generator
686687

687688
def f() -> int:
688689
return 1
689690

690691
def 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

0 commit comments

Comments
 (0)