diff options
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.8.rst | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 2b4eb63..07202ea 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -1111,6 +1111,32 @@ unittest * Several mock assert functions now also print a list of actual calls upon failure. (Contributed by Petter Strandmark in :issue:`35047`.) +* :mod:`unittest` module gained support for coroutines to be used as test cases + with :class:`unittest.IsolatedAsyncioTestCase`. + (Contributed by Andrew Svetlov in :issue:`32972`.) + + Example:: + + import unittest + + + class TestRequest(unittest.IsolatedAsyncioTestCase): + + async def asyncSetUp(self): + self.connection = await AsyncConnection() + + async def test_get(self): + response = await self.connection.get("https://example.com") + self.assertEqual(response.status_code, 200) + + async def asyncTearDown(self): + await self.connection.close() + + + if __name__ == "__main__": + unittest.main() + + venv ---- |