• Home
  • Raw
  • Download

Lines Matching refs:stack

589         with self.exit_stack() as stack:
592 f = stack.callback(_exit, *args, **kwds)
594 f = stack.callback(_exit, *args)
596 f = stack.callback(_exit, **kwds)
598 f = stack.callback(_exit)
600 for wrapper in stack._exit_callbacks:
607 with self.exit_stack() as stack:
609 stack.callback(arg=1)
613 stack.callback(callback=_exit, arg=3)
633 with self.exit_stack() as stack:
634 stack.push(_expect_ok)
635 self.assertIs(stack._exit_callbacks[-1][1], _expect_ok)
637 stack.push(cm)
638 self.assertIs(stack._exit_callbacks[-1][1].__self__, cm)
639 stack.push(_suppress_exc)
640 self.assertIs(stack._exit_callbacks[-1][1], _suppress_exc)
642 stack.push(cm)
643 self.assertIs(stack._exit_callbacks[-1][1].__self__, cm)
644 stack.push(_expect_exc)
645 self.assertIs(stack._exit_callbacks[-1][1], _expect_exc)
646 stack.push(_expect_exc)
647 self.assertIs(stack._exit_callbacks[-1][1], _expect_exc)
659 with self.exit_stack() as stack:
660 @stack.callback # Registered first => cleaned up last
664 stack.enter_context(cm)
665 self.assertIs(stack._exit_callbacks[-1][1].__self__, cm)
671 with self.exit_stack() as stack:
672 @stack.callback
676 stack.close()
682 with self.exit_stack() as stack:
683 @stack.callback
687 new_stack = stack.pop_all()
695 with self.exit_stack() as stack:
696 stack.push(lambda *exc: False)
700 with self.exit_stack() as stack:
701 stack.push(lambda *exc: True)
764 with self.exit_stack() as stack:
765 stack.callback(raise_exc, IndexError)
766 stack.callback(raise_exc, KeyError)
767 stack.callback(raise_exc, AttributeError)
768 stack.push(suppress_exc)
769 stack.callback(raise_exc, ValueError)
803 with self.exit_stack() as stack:
804 stack.enter_context(my_cm())
805 yield stack
826 with self.exit_stack() as stack:
827 stack.callback(lambda: None)
828 stack.callback(raise_exc, IndexError)
835 with self.exit_stack() as stack:
836 stack.callback(raise_exc, KeyError)
837 stack.push(suppress_exc)
838 stack.callback(raise_exc, IndexError)
862 with self.exit_stack() as stack:
863 stack.enter_context(gets_the_context_right(exc4))
864 stack.enter_context(gets_the_context_right(exc3))
865 stack.enter_context(gets_the_context_right(exc2))
889 with self.exit_stack() as stack:
890 stack.callback(raise_nested, exc4, exc5)
891 stack.callback(raise_nested, exc2, exc3)
907 with self.exit_stack() as stack:
908 stack.push(suppress_exc)
914 with self.exit_stack() as stack:
915 stack.push(lambda *exc: True)
916 stack.push(lambda *exc: 1/0)
917 stack.push(lambda *exc: {}[1])
921 with self.exit_stack() as stack:
923 stack.callback(int)
929 stack = self.exit_stack()
930 self.assertRaises(AttributeError, stack.enter_context, cm)
931 stack.push(cm)
932 self.assertIs(stack._exit_callbacks[-1][1], cm)