Example #1
0
    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)
Example #2
0
 def testDeltaToStartTimeException(self):
     
     # create a race
     race = Race(name='Brass Monkey Race 2 Large Handicap')
     # check that we get an exception if we ask for a start time
     try:
         delta = race.deltaToStartTime()
     except RaceException:
         pass
     except:
         e = sys.exc_info()[0]
         self.fail('Unexpected exception thrown:',e)
     else:
         self.fail('RaceException not thrown')