def testPauseAndResumePomodoros(self): pomo = Pomodoro() # we cannot pause a Pomodoro that has not been started yet self.assertRaises( Exception, pomo.pause ) pomo.start() time1 = pomo.getTimeLeft() pomo.pause() time.sleep(1) pomo.resume() time2 = pomo.getTimeLeft() self.assertTrue( time2 + timedelta(seconds=1) < time1 )
def testPomodoroPausesCounter(self): pomo = Pomodoro() pomo.start() self.assertEquals( pomo.pauses, 0 ) pomo.pause() pomo.resume() self.assertEquals( pomo.pauses, 1 ) i=0 while i<10: pomo.pause() pomo.resume() i += 1 self.assertEquals( pomo.pauses, 11 )