def testRaceStartingNow(self): # create a race race = Race(name='Brass Monkey Race 2 Large Handicap') # set it's start time to be in three minutes race.startTime = datetime.datetime.now() + datetime.timedelta(seconds = START_SECONDS-1) # check that it's running but not started self.assertTrue(race.isRunning()) self.assertFalse(race.isStarted()) # check its status self.assertEqual(race.status(),"Starting")
def testDeltaToStartTime(self): # create a race race = Race(name='Brass Monkey Race 2 Large Handicap') # set it's start time to be in ten minutes race.startTime = datetime.datetime.now() + datetime.timedelta(minutes = -10) # test that the delta is ten minutes # note this may fail if the clock moves on during execution self.assertEqual(race.deltaToStartTime(), datetime.datetime.now() - race.startTime)