Files
pytest2/testing/example_scripts/unittest/test_unittest_asyncio.py
Ronny Pfannschmidt 451aef65ac prepare tests and disable warnings for asyncio unittest cases
shoehorn unittest async results into python test result interpretation

changelog
2020-03-30 21:55:12 +02:00

16 lines
421 B
Python

from unittest import IsolatedAsyncioTestCase # type: ignore
class AsyncArguments(IsolatedAsyncioTestCase):
async def test_something_async(self):
async def addition(x, y):
return x + y
self.assertEqual(await addition(2, 2), 4)
async def test_something_async_fails(self):
async def addition(x, y):
return x + y
self.assertEqual(await addition(2, 2), 3)