コード例 #1
0
 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
コード例 #2
0
 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
コード例 #3
0
 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