MCPcopy Index your code
hub / github.com/python/cpython / test_pop_all

Method test_pop_all

Lib/test/test_contextlib.py:890–901  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

888 self.assertEqual(result, [1, 2])
889
890 def test_pop_all(self):
891 result = []
892 with self.exit_stack() as stack:
893 @stack.callback
894 def _exit():
895 result.append(3)
896 self.assertIsNotNone(_exit)
897 new_stack = stack.pop_all()
898 result.append(1)
899 result.append(2)
900 new_stack.close()
901 self.assertEqual(result, [1, 2, 3])
902
903 def test_exit_raise(self):
904 with self.assertRaises(ZeroDivisionError):

Callers

nothing calls this directly

Calls 5

assertIsNotNoneMethod · 0.80
pop_allMethod · 0.45
appendMethod · 0.45
closeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected