def test_halt(self): watch = StopWatch() watch.halt() first = watch.get() time.sleep(0.1) second = watch.get() self.assertEqual(first, second)
def test_resume(self): watch = StopWatch() watch.halt() first = watch.get() watch.resume() time.sleep(0.1) second = watch.get() # See test_get self.assertAlmostEqual(second - first, 0.1, places=2)