示例#1
0
 def test_stop(self):
     timer = Timer()
     time.sleep(5)
     timer.stop()
     time.sleep(3)
     timer.start()
     time.sleep(5)
     self.assertEqual(timer.get_counter(),10)
示例#2
0
 def test_init(self):
     timer = Timer()
     time.sleep(5)
     self.assertEqual(timer.get_counter(),20)
示例#3
0
 def test_interrupt_with_fischer(self):
     timer = Timer(20, 20)
     timer.start()
     time.sleep(5)
     timer.interrupt()
     self.assertEqual(timer.get_counter(), 15)
示例#4
0
 def test_stop_with_fischer(self):
     timer = Timer(20, 20)
     timer.start()
     time.sleep(5)
     timer.stop()
     self.assertEqual(timer.get_counter(), 35)