1
1
from functools import reduce
2
- from inspect import isawaitable
3
2
4
3
from pytest import mark
5
4
6
- from graphql .pyutils import async_reduce
5
+ from graphql .pyutils import async_reduce , is_awaitable
7
6
8
7
9
8
def describe_async_reduce ():
@@ -25,7 +24,7 @@ def callback(accumulator, current_value):
25
24
26
25
values = ["bar" , "baz" ]
27
26
result = async_reduce (callback , values , "foo" )
28
- assert not isawaitable (result )
27
+ assert not is_awaitable (result )
29
28
assert result == "foo-bar-baz"
30
29
31
30
@mark .asyncio
@@ -38,7 +37,7 @@ def callback(accumulator, current_value):
38
37
39
38
values = ["bar" , "baz" ]
40
39
result = async_reduce (callback , values , async_initial_value ())
41
- assert isawaitable (result )
40
+ assert is_awaitable (result )
42
41
assert await result == "foo-bar-baz"
43
42
44
43
@mark .asyncio
@@ -48,7 +47,7 @@ async def async_callback(accumulator, current_value):
48
47
49
48
values = ["bar" , "baz" ]
50
49
result = async_reduce (async_callback , values , "foo" )
51
- assert isawaitable (result )
50
+ assert is_awaitable (result )
52
51
assert await result == "foo-bar-baz"
53
52
54
53
@mark .asyncio
@@ -60,5 +59,5 @@ async def async_callback(accumulator, current_value):
60
59
return accumulator * current_value
61
60
62
61
result = async_reduce (async_callback , range (6 , 9 ), async_initial_value ())
63
- assert isawaitable (result )
62
+ assert is_awaitable (result )
64
63
assert await result == 42
0 commit comments