Lines Matching refs:stack
641 with self.exit_stack() as stack:
644 f = stack.callback(_exit, *args, **kwds)
646 f = stack.callback(_exit, *args)
648 f = stack.callback(_exit, **kwds)
650 f = stack.callback(_exit)
652 for wrapper in stack._exit_callbacks:
659 with self.exit_stack() as stack:
661 stack.callback(arg=1)
665 stack.callback(callback=_exit, arg=3)
685 with self.exit_stack() as stack:
686 stack.push(_expect_ok)
687 self.assertIs(stack._exit_callbacks[-1][1], _expect_ok)
689 stack.push(cm)
690 self.assertIs(stack._exit_callbacks[-1][1].__self__, cm)
691 stack.push(_suppress_exc)
692 self.assertIs(stack._exit_callbacks[-1][1], _suppress_exc)
694 stack.push(cm)
695 self.assertIs(stack._exit_callbacks[-1][1].__self__, cm)
696 stack.push(_expect_exc)
697 self.assertIs(stack._exit_callbacks[-1][1], _expect_exc)
698 stack.push(_expect_exc)
699 self.assertIs(stack._exit_callbacks[-1][1], _expect_exc)
711 with self.exit_stack() as stack:
712 @stack.callback # Registered first => cleaned up last
716 stack.enter_context(cm)
717 self.assertIs(stack._exit_callbacks[-1][1].__self__, cm)
731 with self.exit_stack() as stack:
733 stack.enter_context(LacksEnterAndExit())
735 stack.enter_context(LacksEnter())
737 stack.enter_context(LacksExit())
738 self.assertFalse(stack._exit_callbacks)
742 with self.exit_stack() as stack:
743 @stack.callback
747 stack.close()
753 with self.exit_stack() as stack:
754 @stack.callback
758 new_stack = stack.pop_all()
766 with self.exit_stack() as stack:
767 stack.push(lambda *exc: False)
771 with self.exit_stack() as stack:
772 stack.push(lambda *exc: True)
785 with self.exit_stack() as stack:
786 stack.callback(raise_exc, ValueError)
794 [('test_exit_exception_traceback', 'with self.exit_stack() as stack:')] + \
867 with self.exit_stack() as stack:
868 stack.callback(raise_exc, IndexError)
869 stack.callback(raise_exc, KeyError)
870 stack.callback(raise_exc, AttributeError)
871 stack.push(suppress_exc)
872 stack.callback(raise_exc, ValueError)
906 with self.exit_stack() as stack:
907 stack.enter_context(my_cm())
908 yield stack
929 with self.exit_stack() as stack:
930 stack.callback(lambda: None)
931 stack.callback(raise_exc, IndexError)
938 with self.exit_stack() as stack:
939 stack.callback(raise_exc, KeyError)
940 stack.push(suppress_exc)
941 stack.callback(raise_exc, IndexError)
965 with self.exit_stack() as stack:
966 stack.enter_context(gets_the_context_right(exc4))
967 stack.enter_context(gets_the_context_right(exc3))
968 stack.enter_context(gets_the_context_right(exc2))
992 with self.exit_stack() as stack:
993 stack.callback(raise_nested, exc4, exc5)
994 stack.callback(raise_nested, exc2, exc3)
1010 with self.exit_stack() as stack:
1011 stack.push(suppress_exc)
1017 with self.exit_stack() as stack:
1018 stack.push(lambda *exc: True)
1019 stack.push(lambda *exc: 1/0)
1020 stack.push(lambda *exc: {}[1])
1024 with self.exit_stack() as stack:
1026 stack.callback(int)
1033 stack = self.exit_stack()
1035 stack.enter_context(cm)
1036 stack.push(cm)
1037 self.assertIs(stack._exit_callbacks[-1][1], cm)