File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -20,24 +20,24 @@ Usage
20
20
21
21
# an async object method to demonstrate use
22
22
class async_class :
23
- async def method (self ):
24
- return True
23
+ async def sum (self , a , b ):
24
+ return a + b
25
25
async_object = async_class()
26
26
27
27
# wrap all async methods of an object
28
28
sync_object = sync.methods(async_object)
29
29
30
- assert sync_object.method() is True
30
+ assert sync_object.sum( 1 , 2 ) == 3
31
31
32
32
# wrap a single async callable
33
- sync_function = sync.function(async_object.method )
33
+ sync_function = sync.function(async_object.sum )
34
34
35
- assert sync_function() is True
35
+ assert sync_function(4 , 5 ) == 9
36
36
37
37
# wait for a coroutine
38
- sync_result = sync.coroutine(async_object.method( ))
38
+ sync_result = sync.coroutine(async_object.sum( 6 , 7 ))
39
39
40
- assert sync_result is True
40
+ assert sync_result == 13
41
41
42
42
# manually stop default event loop
43
43
sync.stop()
You can’t perform that action at this time.
0 commit comments