2020-05-01 19:40:17 +08:00
|
|
|
from typing import List
|
2020-03-15 01:50:43 +08:00
|
|
|
from unittest import IsolatedAsyncioTestCase # type: ignore
|
|
|
|
|
|
|
|
|
2020-10-06 09:13:05 +08:00
|
|
|
teardowns: List[None] = []
|
2020-05-01 23:56:06 +08:00
|
|
|
|
|
|
|
|
2020-03-15 01:50:43 +08:00
|
|
|
class AsyncArguments(IsolatedAsyncioTestCase):
|
2020-05-01 23:56:06 +08:00
|
|
|
async def asyncTearDown(self):
|
|
|
|
teardowns.append(None)
|
|
|
|
|
2020-03-15 01:50:43 +08:00
|
|
|
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)
|
2020-05-01 23:56:06 +08:00
|
|
|
|
|
|
|
def test_teardowns(self):
|
|
|
|
assert len(teardowns) == 2
|