@@ -31,8 +31,7 @@ def test_basic_call_coroutine():
31
31
"""The most basic Happy-Path test for Hug APIs using async"""
32
32
33
33
@hug .call ()
34
- @asyncio .coroutine
35
- def hello_world ():
34
+ async def hello_world ():
36
35
return "Hello World!"
37
36
38
37
assert loop .run_until_complete (hello_world ()) == "Hello World!"
@@ -42,25 +41,22 @@ def test_nested_basic_call_coroutine():
42
41
"""The most basic Happy-Path test for Hug APIs using async"""
43
42
44
43
@hug .call ()
45
- @asyncio .coroutine
46
- def hello_world ():
44
+ async def hello_world ():
47
45
return getattr (asyncio , "ensure_future" )(nested_hello_world ())
48
46
49
47
@hug .local ()
50
- @asyncio .coroutine
51
- def nested_hello_world ():
48
+ async def nested_hello_world ():
52
49
return "Hello World!"
53
50
54
- assert loop .run_until_complete (hello_world ()) == "Hello World!"
51
+ assert loop .run_until_complete (hello_world ()). result () == "Hello World!"
55
52
56
53
57
54
def test_basic_call_on_method_coroutine ():
58
55
"""Test to ensure the most basic call still works if applied to a method"""
59
56
60
57
class API (object ):
61
58
@hug .call ()
62
- @asyncio .coroutine
63
- def hello_world (self = None ):
59
+ async def hello_world (self = None ):
64
60
return "Hello World!"
65
61
66
62
api_instance = API ()
@@ -79,8 +75,7 @@ def hello_world(self):
79
75
api_instance = API ()
80
76
81
77
@hug .call ()
82
- @asyncio .coroutine
83
- def hello_world ():
78
+ async def hello_world ():
84
79
return api_instance .hello_world ()
85
80
86
81
assert api_instance .hello_world () == "Hello World!"
@@ -94,8 +89,7 @@ class API(object):
94
89
def __init__ (self ):
95
90
hug .call ()(self .hello_world_method )
96
91
97
- @asyncio .coroutine
98
- def hello_world_method (self ):
92
+ async def hello_world_method (self ):
99
93
return "Hello World!"
100
94
101
95
api_instance = API ()
0 commit comments