MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_await_9

Method test_await_9

Lib/test/test_coroutines.py:1055–1075  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1053 run_async(foo())
1054
1055 def test_await_9(self):
1056 def wrap():
1057 return bar
1058
1059 async def bar():
1060 return 42
1061
1062 async def foo():
1063 db = {'b': lambda: wrap}
1064
1065 class DB:
1066 b = wrap
1067
1068 return (await bar() + await wrap()() + await db['b']()()() +
1069 await bar() * 1000 + await DB.b()())
1070
1071 async def foo2():
1072 return -await bar()
1073
1074 self.assertEqual(run_async(foo()), ([], 42168))
1075 self.assertEqual(run_async(foo2()), ([], -42))
1076
1077 def test_await_10(self):
1078 async def baz():

Callers

nothing calls this directly

Calls 3

run_asyncFunction · 0.70
fooFunction · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected