summaryrefslogtreecommitdiff
path: root/Lib/test/test_contextlib_async.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_contextlib_async.py')
-rw-r--r--Lib/test/test_contextlib_async.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_contextlib_async.py b/Lib/test/test_contextlib_async.py
index 109807d633..290ef05b82 100644
--- a/Lib/test/test_contextlib_async.py
+++ b/Lib/test/test_contextlib_async.py
@@ -1,5 +1,7 @@
import asyncio
-from contextlib import aclosing, asynccontextmanager, AbstractAsyncContextManager, AsyncExitStack
+from contextlib import (
+ asynccontextmanager, AbstractAsyncContextManager,
+ AsyncExitStack, nullcontext, aclosing)
import functools
from test import support
import unittest
@@ -537,5 +539,15 @@ class TestAsyncExitStack(TestBaseExitStack, unittest.TestCase):
self.assertIsInstance(inner_exc.__context__, ZeroDivisionError)
+class TestAsyncNullcontext(unittest.TestCase):
+ @_async_test
+ async def test_async_nullcontext(self):
+ class C:
+ pass
+ c = C()
+ async with nullcontext(c) as c_in:
+ self.assertIs(c_in, c)
+
+
if __name__ == '__main__':
unittest.main()