@@ -38,22 +38,38 @@ async def hello_world():
3838
3939
4040def test_basic_call_on_method_async ():
41+ """Test to ensure the most basic call still works if applied to a method"""
42+ class API (object ):
4143
44+ @hug .call ()
45+ async def hello_world (self = None ):
46+ return "Hello World!"
47+
48+ api_instance = API ()
49+ assert api_instance .hello_world .interface .http
50+ assert loop .run_until_complete (api_instance .hello_world ()) == "Hello World!"
51+ assert hug .test .get (api , '/hello_world' ).data == "Hello World!"
52+
53+
54+ def test_nested_call_on_method_async ():
4255 """Test to ensure the most basic call still works if applied to a method"""
4356 class API (object ):
4457
4558 @hug .call ()
4659 async def hello_world (self = None ):
4760 return "Hello World!"
4861
62+ @hug .local ()
63+ async def
64+
4965 api_instance = API ()
5066 assert api_instance .hello_world .interface .http
5167 assert loop .run_until_complete (api_instance .hello_world ()) == "Hello World!"
5268 assert hug .test .get (api , '/hello_world' ).data == "Hello World!"
5369
5470
5571def test_basic_call_on_method_through_api_instance_async ():
56-
72+ """Test to ensure instance method calling via async works as expected"""
5773 class API (object ):
5874
5975 def hello_world (self ):
@@ -70,7 +86,7 @@ async def hello_world():
7086
7187
7288def test_basic_call_on_method_registering_without_decorator_async ():
73-
89+ """Test to ensure async methods can be used without decorator"""
7490 class API (object ):
7591
7692 def __init__ (self ):
@@ -83,3 +99,5 @@ async def hello_world_method(self):
8399
84100 assert loop .run_until_complete (api_instance .hello_world_method ()) == "Hello World!"
85101 assert hug .test .get (api , '/hello_world_method' ).data == "Hello World!"
102+
103+
0 commit comments