def test_nested_outer_precedence(self): tmp_outer = Timeout(1) tmp_inner = Timeout(2) with tmp_outer: self.assertEqual(tmp_outer.data, Timeout.current()) with tmp_inner: self.assertEqual(tmp_outer.data, Timeout.current()) self.assertEqual(tmp_outer.data, Timeout.current()) self.assertEqual(None, Timeout.current())
def test_current_timeout(self): self.assertEqual(None, Timeout.current()) with Timeout(1) as tmp: self.assertEqual(tmp.data, Timeout.current()) self.assertEqual(None, Timeout.current())