MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_pop_all

Method test_pop_all

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

Source from the content-addressed store, hash-verified

819 self.assertEqual(result, [1, 2])
820
821 def test_pop_all(self):
822 result = []
823 with self.exit_stack() as stack:
824 @stack.callback
825 def _exit():
826 result.append(3)
827 self.assertIsNotNone(_exit)
828 new_stack = stack.pop_all()
829 result.append(1)
830 result.append(2)
831 new_stack.close()
832 self.assertEqual(result, [1, 2, 3])
833
834 def test_exit_raise(self):
835 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