summaryrefslogtreecommitdiffstats
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 2a44404..30c2e27 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -575,6 +575,7 @@ class TestBaseExitStack:
((), dict(example=1)),
((1,), dict(example=1)),
((1,2), dict(example=1)),
+ ((1,2), dict(self=3, callback=4)),
]
result = []
def _exit(*args, **kwds):
@@ -597,6 +598,15 @@ class TestBaseExitStack:
self.assertIsNone(wrapper[1].__doc__, _exit.__doc__)
self.assertEqual(result, expected)
+ result = []
+ with self.exit_stack() as stack:
+ with self.assertRaises(TypeError):
+ stack.callback(arg=1)
+ with self.assertRaises(TypeError):
+ self.exit_stack.callback(arg=2)
+ stack.callback(callback=_exit, arg=3)
+ self.assertEqual(result, [((), {'arg': 3})])
+
def test_push(self):
exc_raised = ZeroDivisionError
def _expect_exc(exc_type, exc, exc_tb):