@@ -68,6 +68,9 @@ class C:
6868 def __init__(self, s: str) -> None:
6969 self.s = s
7070
71+ def concat(self, s: str) -> str:
72+ return self.s + s
73+
7174async def make_c(s: str) -> C:
7275 await one()
7376 return C(s)
@@ -94,6 +97,33 @@ def test_set_attr() -> None:
9497 assert asyncio.run(set_attr1("foo")) == "foo!"
9598 asyncio.run(set_attr2("foo")) # Just check that it compiles and runs
9699
100+ def upper(s: str) -> str:
101+ return s.upper()
102+
103+ async def call1(s: str) -> str:
104+ return upper(await concat(s, "a"))
105+
106+ async def call2(s: str) -> str:
107+ return await concat(await concat(s, "a"), "b")
108+
109+ def test_call() -> None:
110+ assert asyncio.run(call1("foo")) == "FOOA"
111+ assert asyncio.run(call2("foo")) == "fooab"
112+
113+ async def method_call(s: str) -> str:
114+ c = C("<")
115+ return c.concat(await concat(s, ">"))
116+
117+ def test_method_call() -> None:
118+ assert asyncio.run(method_call("foo")) == "<foo>"
119+
120+ async def construct(s: str) -> str:
121+ c = C(await concat(s, "!"))
122+ return c.s
123+
124+ def test_construct() -> None:
125+ assert asyncio.run(construct("foo")) == "foo!"
126+
97127[file asyncio/__init__.pyi]
98128async def sleep(t: float) -> None: ...
99129# eh, we could use the real type but it doesn't seem important
0 commit comments