Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f42b62 commit eadb966Copy full SHA for eadb966
Lib/test/test_asyncio/test_threads.py
@@ -30,15 +30,17 @@ async def test_to_thread_once(self):
30
func.assert_called_once()
31
32
async def test_to_thread_concurrent(self):
33
- func = mock.Mock()
+ calls = []
34
+ def func():
35
+ calls.append(1)
36
37
futs = []
38
for _ in range(10):
39
fut = asyncio.to_thread(func)
40
futs.append(fut)
41
await asyncio.gather(*futs)
42
- self.assertEqual(func.call_count, 10)
43
+ self.assertEqual(sum(calls), 10)
44
45
async def test_to_thread_args_kwargs(self):
46
# Unlike run_in_executor(), to_thread() should directly accept kwargs.
0 commit comments