Skip to content

Commit 816924d

Browse files
committed
Add tests with static and class methods
1 parent 34167d5 commit 816924d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

mypyc/test-data/run-async.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,22 @@ class T:
14601460
async def returns_two_async(self) -> int:
14611461
return 1
14621462

1463+
@staticmethod
1464+
def static() -> int:
1465+
return 2
1466+
1467+
@staticmethod
1468+
async def static_async() -> int:
1469+
return 2
1470+
1471+
@classmethod
1472+
def class_method(cls) -> int:
1473+
return 3
1474+
1475+
@classmethod
1476+
async def class_method_async(cls) -> int:
1477+
return 3
1478+
14631479
def is_coroutine(fn):
14641480
if sys.version_info >= (3, 10):
14651481
return inspect.iscoroutinefunction(fn)
@@ -1506,6 +1522,14 @@ def test_method() -> None:
15061522
assert is_coroutine(T.returns_two_async)
15071523
assert asyncio.run(t.returns_two_async()) == 2
15081524

1525+
assert not is_coroutine(T.static)
1526+
assert is_coroutine(T.static_async)
1527+
assert asyncio.run(T.static_async()) == 2
1528+
1529+
assert not is_coroutine(T.class_method)
1530+
assert is_coroutine(T.class_method_async)
1531+
assert asyncio.run(T.class_method_async()) == 3
1532+
15091533
def test_nested() -> None:
15101534
def nested() -> int:
15111535
return 1

0 commit comments

Comments
 (0)