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 testStartAndRestartPomodoros(self): pomo = Pomodoro() pomo.start() self.assertTrue( pomo.getTimeLeft() < timedelta(minutes=25), 'A started pomodoro initiates the countdown' ) pomo.start() self.assertTrue( pomo.getTimeLeft().seconds/60 == 24 )