def test_fails_until_time_elapsed(self): obj = DeltaTime(threshold=5) t = 0 obj.update(timestamp=t) # record pass at time t while not obj.check(timestamp=t): # next steps t += 2 assert t == 6
def test_passes_next_step_without_update(self): obj = DeltaTime(threshold=1) result_first = obj.check(timestamp=0) # first step assert result_first result_next = obj.check(timestamp=0.1) # next step assert result_next
def test_fails_next_step_with_small_step(self): obj = DeltaTime(threshold=1) obj.update(timestamp=0) # record pass at time 0 result = obj.check(timestamp=0.1) # next step assert not result
def test_passes_next_step_with_zero_step(self): obj = DeltaTime(threshold=0) obj.update(timestamp=0) # record pass at time 0 result = obj.check(timestamp=0) # next step assert result
def test_passes_first_step_always(self): obj = DeltaTime(threshold=1) result = obj.check(timestamp=0) assert result