Skip to content

Commit bb6a4de

Browse files
committed
✅ Add tests for async.
1 parent 0d9fea9 commit bb6a4de

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_seializers.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ def function_config_test(self, data: SimpleConfigModel):
9393
def function_same_name_test(self, test_attr: SimpleModel):
9494
return test_attr
9595

96+
async def async_function_simple_model(self, param: SimpleModel) -> SimpleTestModel:
97+
return {'test': param['test_attr']} # type: ignore
98+
99+
async def async_function_return_none(self, param: SimpleModel) -> None:
100+
pass
101+
96102

97103
def test_function_without_all():
98104
client = Client()
@@ -217,6 +223,25 @@ def test_function_config_test():
217223
assert client.function_config_test(test_attr='bla') == {'TestAttr': 'bla'} # type: ignore
218224

219225

226+
@pytest.mark.asyncio()
227+
async def test_async_function_return_none():
228+
client = Client()
229+
response = await client.async_function_return_none(test_attr='test') # type: ignore
230+
assert response is None
231+
232+
233+
@pytest.mark.asyncio()
234+
async def test_async_function_simple_model():
235+
client = Client()
236+
response = await client.async_function_simple_model() # type: ignore
237+
assert isinstance(response, SimpleTestModel)
238+
assert response.dict() == {'test': 'Param'}
239+
240+
response = await client.async_function_simple_model(test_attr='test') # type: ignore
241+
assert isinstance(response, SimpleTestModel)
242+
assert response.dict() == {'test': 'test'}
243+
244+
220245
@pytest.mark.xfail()
221246
def test_function_same_name_test():
222247
client = Client()

0 commit comments

Comments
 (0)