def test_does_not_reach_max_hops1(self): """Request does not expire with non-default value after a few dispatches""" r = Request(id=1, dispatcher=lambda o: o, args=1, hop_limit=5) for _ in range(3): r.dispatch() self.assertFalse(r.expired())
def test_reaches_max_hops1(self): """Request expires with non-default value after appropriate amount of time""" r = Request(id=1, dispatcher=lambda o: o, args=1, hop_limit=5) for _ in range(5): r.dispatch() self.assertTrue(r.expired())
def test_does_not_reach_max_hops0(self): """Request does not expire with default value after no dispatches""" r = Request(id=1, dispatcher=lambda o: o, args=1, hop_limit=5) self.assertFalse(r.expired())
def test_reaches_max_hops(self): """Request exipires by default after one dispatch""" r = Request(id=1, dispatcher=lambda o: o, args=1) r.dispatch() self.assertTrue(r.expired())