aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_contextlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_contextlib.py')
-rw-r--r--Lib/test/test_contextlib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index 64b6578ff94..1a5e6edad9b 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -252,6 +252,16 @@ class ClosingTestCase(unittest.TestCase):
1 / 0
self.assertEqual(state, [1])
+
+class NullcontextTestCase(unittest.TestCase):
+ def test_nullcontext(self):
+ class C:
+ pass
+ c = C()
+ with nullcontext(c) as c_in:
+ self.assertIs(c_in, c)
+
+
class FileContextTestCase(unittest.TestCase):
def testWithOpen(self):