Skip to content

Commit 08cd3dc

Browse files
committedJan 8, 2021
demonstrate function call better
1 parent 4925a92 commit 08cd3dc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎README.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ Usage
2020
2121
# an async object method to demonstrate use
2222
class async_class:
23-
async def method(self):
24-
return True
23+
async def sum(self, a, b):
24+
return a + b
2525
async_object = async_class()
2626
2727
# wrap all async methods of an object
2828
sync_object = sync.methods(async_object)
2929
30-
assert sync_object.method() is True
30+
assert sync_object.sum(1,2) == 3
3131
3232
# wrap a single async callable
33-
sync_function = sync.function(async_object.method)
33+
sync_function = sync.function(async_object.sum)
3434
35-
assert sync_function() is True
35+
assert sync_function(4,5) == 9
3636
3737
# wait for a coroutine
38-
sync_result = sync.coroutine(async_object.method())
38+
sync_result = sync.coroutine(async_object.sum(6,7))
3939
40-
assert sync_result is True
40+
assert sync_result == 13
4141
4242
# manually stop default event loop
4343
sync.stop()

0 commit comments

Comments
 (0)