def createPmFinale(self): self.friPmFinale = SessionSimulator() self.friPmFinale.create('Fri pm Boarder X Finale', datetime(2000, 1, 1, 16, 45), datetime(2000, 1, 1, 17, 0), 'rc', self.boarderCross, self.event, self.chronos, self.beacons)
def __init__(self, championship): self.championship = championship self.morningTest = SessionSimulator() self.morningChrono = SessionSimulator() self.boarderCross = self.championship.boarderCross self.fake1 = self.championship.fake1 self.chrono = self.championship.chrono self.beacons = self.championship.beacons
def __init__(self, championship): self.championship = championship self.qualification = SessionSimulator() self.sessions32 = [] self.sessions16 = [] self.sessions8 = [] self.sessions4 = [] self.sessions2 = [] self.finale = None self.dual = self.championship.dual self.fake1 = self.championship.fake1 self.chrono = self.championship.chrono self.beacons = self.championship.beacons self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.eliteCategory = self.championship.eliteCategory self.openCategory = self.championship.openCategory self.womanCategory = self.championship.womanCategory self.juniorCategory = self.championship.juniorCategory
def createPmSemiSessions(self): friPmSemiRun1 = SessionSimulator() friPmSemiRun1.create('Fri pm Boarder X 1/2 #1', datetime(2000, 1, 1, 16, 30), datetime(2000, 1, 1, 16, 34), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPmSemiRun2 = SessionSimulator() friPmSemiRun2.create('Fri pm Boarder X 1/2 #2', datetime(2000, 1, 1, 16, 34), datetime(2000, 1, 1, 16, 38), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPmSemiSessions = [friPmSemiRun1, friPmSemiRun2]
def __init__(self, championship): self.championship = championship self.fake1 = self.championship.fake1 self.chrono = self.championship.chrono self.beacons = self.championship.beacons self.allPilots = self.championship.allPilots self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.mercantour = self.championship.mercantour self.satDerby1Elite = SessionSimulator() self.satDerby1Open = SessionSimulator() self.satDerby1Woman = SessionSimulator() self.satDerby1Junior = SessionSimulator()
def __init__(self, championship): self.championship = championship self.event = self.championship.event self.boarderCross = self.championship.boarderCross self.chronos = [self.championship.fake1, self.championship.chrono] self.allPilots = self.championship.allPilots self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.mercantour = self.championship.mercantour self.sessionSim = SessionSimulator() self.friPm16Sessions = [] self.friPm8Sessions = [] self.friPm4Sessions = [] self.friPmSemiSessions = [] self.friPmFinale = None self.beacons = self.championship.beacons
def createPm16Sessions(self): friPm16Run1 = SessionSimulator() friPm16Run1.create('Fri pm Boarder X 1/16 #1', datetime(2000, 1, 1, 14, 0), datetime(2000, 1, 1, 14, 4), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run2 = SessionSimulator() friPm16Run2.create('Fri pm Boarder X 1/16 #2', datetime(2000, 1, 1, 14, 4), datetime(2000, 1, 1, 14, 8), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run3 = SessionSimulator() friPm16Run3.create('Fri pm Boarder X 1/16 #3', datetime(2000, 1, 1, 14, 8), datetime(2000, 1, 1, 14, 12), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run4 = SessionSimulator() friPm16Run4.create('Fri pm Boarder X 1/16 #4', datetime(2000, 1, 1, 14, 12), datetime(2000, 1, 1, 14, 16), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run5 = SessionSimulator() friPm16Run5.create('Fri pm Boarder X 1/16 #5', datetime(2000, 1, 1, 14, 16), datetime(2000, 1, 1, 14, 20), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run6 = SessionSimulator() friPm16Run6.create('Fri pm Boarder X 1/16 #6', datetime(2000, 1, 1, 14, 20), datetime(2000, 1, 1, 14, 24), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run7 = SessionSimulator() friPm16Run7.create('Fri pm Boarder X 1/16 #7', datetime(2000, 1, 1, 14, 24), datetime(2000, 1, 1, 14, 28), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run8 = SessionSimulator() friPm16Run8.create('Fri pm Boarder X 1/16 #8', datetime(2000, 1, 1, 14, 28), datetime(2000, 1, 1, 14, 32), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run9 = SessionSimulator() friPm16Run9.create('Fri pm Boarder X 1/16 #9', datetime(2000, 1, 1, 14, 32), datetime(2000, 1, 1, 14, 36), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run10 = SessionSimulator() friPm16Run10.create('Fri pm Boarder X 1/16 #10', datetime(2000, 1, 1, 14, 36), datetime(2000, 1, 1, 14, 40), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run11 = SessionSimulator() friPm16Run11.create('Fri pm Boarder X 1/16 #11', datetime(2000, 1, 1, 14, 40), datetime(2000, 1, 1, 14, 44), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run12 = SessionSimulator() friPm16Run12.create('Fri pm Boarder X 1/16 #12', datetime(2000, 1, 1, 14, 44), datetime(2000, 1, 1, 14, 48), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run13 = SessionSimulator() friPm16Run13.create('Fri pm Boarder X 1/16 #13', datetime(2000, 1, 1, 14, 48), datetime(2000, 1, 1, 14, 52), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run14 = SessionSimulator() friPm16Run14.create('Fri pm Boarder X 1/16 #14', datetime(2000, 1, 1, 14, 52), datetime(2000, 1, 1, 14, 56), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run15 = SessionSimulator() friPm16Run15.create('Fri pm Boarder X 1/16 #15', datetime(2000, 1, 1, 14, 56), datetime(2000, 1, 1, 15, 0), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run16 = SessionSimulator() friPm16Run16.create('Fri pm Boarder X 1/16 #16', datetime(2000, 1, 1, 15, 0), datetime(2000, 1, 1, 15, 4), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPm16Sessions = [ friPm16Run1, friPm16Run2, friPm16Run3, friPm16Run4, friPm16Run5, friPm16Run6, friPm16Run7, friPm16Run8, friPm16Run9, friPm16Run10, friPm16Run11, friPm16Run12, friPm16Run13, friPm16Run14, friPm16Run15, friPm16Run16 ]
def createPm4Sessions(self): friPm4Run1 = SessionSimulator() friPm4Run1.create('Fri pm Boarder X 1/4 #1', datetime(2000, 1, 1, 16, 0), datetime(2000, 1, 1, 16, 4), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm4Run2 = SessionSimulator() friPm4Run2.create('Fri pm Boarder X 1/4 #2', datetime(2000, 1, 1, 16, 4), datetime(2000, 1, 1, 16, 8), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm4Run3 = SessionSimulator() friPm4Run3.create('Fri pm Boarder X 1/4 #3', datetime(2000, 1, 1, 16, 8), datetime(2000, 1, 1, 16, 12), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm4Run4 = SessionSimulator() friPm4Run4.create('Fri pm Boarder X 1/4 #4', datetime(2000, 1, 1, 16, 12), datetime(2000, 1, 1, 16, 16), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPm4Sessions = [friPm4Run1, friPm4Run2, friPm4Run3, friPm4Run4]
def createPm8Sessions(self): friPm8Run1 = SessionSimulator() friPm8Run1.create('Fri pm Boarder X 1/8 #1', datetime(2000, 1, 1, 15, 16), datetime(2000, 1, 1, 15, 20), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run2 = SessionSimulator() friPm8Run2.create('Fri pm Boarder X 1/8 #2', datetime(2000, 1, 1, 15, 20), datetime(2000, 1, 1, 15, 24), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run3 = SessionSimulator() friPm8Run3.create('Fri pm Boarder X 1/8 #3', datetime(2000, 1, 1, 15, 24), datetime(2000, 1, 1, 15, 28), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run4 = SessionSimulator() friPm8Run4.create('Fri pm Boarder X 1/8 #4', datetime(2000, 1, 1, 15, 28), datetime(2000, 1, 1, 15, 32), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run5 = SessionSimulator() friPm8Run5.create('Fri pm Boarder X 1/8 #5', datetime(2000, 1, 1, 15, 32), datetime(2000, 1, 1, 15, 36), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run6 = SessionSimulator() friPm8Run6.create('Fri pm Boarder X 1/8 #6', datetime(2000, 1, 1, 15, 36), datetime(2000, 1, 1, 15, 40), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run7 = SessionSimulator() friPm8Run7.create('Fri pm Boarder X 1/8 #7', datetime(2000, 1, 1, 15, 40), datetime(2000, 1, 1, 15, 44), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run8 = SessionSimulator() friPm8Run8.create('Fri pm Boarder X 1/8 #8', datetime(2000, 1, 1, 15, 44), datetime(2000, 1, 1, 15, 48), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPm8Sessions = [ friPm8Run1, friPm8Run2, friPm8Run3, friPm8Run4, friPm8Run5, friPm8Run6, friPm8Run7, friPm8Run8 ]
class FridayAfternoonTest: def __init__(self, championship): self.championship = championship self.event = self.championship.event self.boarderCross = self.championship.boarderCross self.chronos = [self.championship.fake1, self.championship.chrono] self.allPilots = self.championship.allPilots self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.mercantour = self.championship.mercantour self.sessionSim = SessionSimulator() self.friPm16Sessions = [] self.friPm8Sessions = [] self.friPm4Sessions = [] self.friPmSemiSessions = [] self.friPmFinale = None self.beacons = self.championship.beacons def createSessions(self): # Add sessions print("---- Create sessions of Friday afternoon ----") self.createPm16Sessions() self.createPm8Sessions() self.createPm4Sessions() self.createPmSemiSessions() self.createPmFinale() def createPm16Sessions(self): friPm16Run1 = SessionSimulator() friPm16Run1.create('Fri pm Boarder X 1/16 #1', datetime(2000, 1, 1, 14, 0), datetime(2000, 1, 1, 14, 4), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run2 = SessionSimulator() friPm16Run2.create('Fri pm Boarder X 1/16 #2', datetime(2000, 1, 1, 14, 4), datetime(2000, 1, 1, 14, 8), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run3 = SessionSimulator() friPm16Run3.create('Fri pm Boarder X 1/16 #3', datetime(2000, 1, 1, 14, 8), datetime(2000, 1, 1, 14, 12), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run4 = SessionSimulator() friPm16Run4.create('Fri pm Boarder X 1/16 #4', datetime(2000, 1, 1, 14, 12), datetime(2000, 1, 1, 14, 16), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run5 = SessionSimulator() friPm16Run5.create('Fri pm Boarder X 1/16 #5', datetime(2000, 1, 1, 14, 16), datetime(2000, 1, 1, 14, 20), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run6 = SessionSimulator() friPm16Run6.create('Fri pm Boarder X 1/16 #6', datetime(2000, 1, 1, 14, 20), datetime(2000, 1, 1, 14, 24), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run7 = SessionSimulator() friPm16Run7.create('Fri pm Boarder X 1/16 #7', datetime(2000, 1, 1, 14, 24), datetime(2000, 1, 1, 14, 28), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run8 = SessionSimulator() friPm16Run8.create('Fri pm Boarder X 1/16 #8', datetime(2000, 1, 1, 14, 28), datetime(2000, 1, 1, 14, 32), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run9 = SessionSimulator() friPm16Run9.create('Fri pm Boarder X 1/16 #9', datetime(2000, 1, 1, 14, 32), datetime(2000, 1, 1, 14, 36), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run10 = SessionSimulator() friPm16Run10.create('Fri pm Boarder X 1/16 #10', datetime(2000, 1, 1, 14, 36), datetime(2000, 1, 1, 14, 40), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run11 = SessionSimulator() friPm16Run11.create('Fri pm Boarder X 1/16 #11', datetime(2000, 1, 1, 14, 40), datetime(2000, 1, 1, 14, 44), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run12 = SessionSimulator() friPm16Run12.create('Fri pm Boarder X 1/16 #12', datetime(2000, 1, 1, 14, 44), datetime(2000, 1, 1, 14, 48), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run13 = SessionSimulator() friPm16Run13.create('Fri pm Boarder X 1/16 #13', datetime(2000, 1, 1, 14, 48), datetime(2000, 1, 1, 14, 52), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run14 = SessionSimulator() friPm16Run14.create('Fri pm Boarder X 1/16 #14', datetime(2000, 1, 1, 14, 52), datetime(2000, 1, 1, 14, 56), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run15 = SessionSimulator() friPm16Run15.create('Fri pm Boarder X 1/16 #15', datetime(2000, 1, 1, 14, 56), datetime(2000, 1, 1, 15, 0), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm16Run16 = SessionSimulator() friPm16Run16.create('Fri pm Boarder X 1/16 #16', datetime(2000, 1, 1, 15, 0), datetime(2000, 1, 1, 15, 4), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPm16Sessions = [ friPm16Run1, friPm16Run2, friPm16Run3, friPm16Run4, friPm16Run5, friPm16Run6, friPm16Run7, friPm16Run8, friPm16Run9, friPm16Run10, friPm16Run11, friPm16Run12, friPm16Run13, friPm16Run14, friPm16Run15, friPm16Run16 ] def createPm8Sessions(self): friPm8Run1 = SessionSimulator() friPm8Run1.create('Fri pm Boarder X 1/8 #1', datetime(2000, 1, 1, 15, 16), datetime(2000, 1, 1, 15, 20), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run2 = SessionSimulator() friPm8Run2.create('Fri pm Boarder X 1/8 #2', datetime(2000, 1, 1, 15, 20), datetime(2000, 1, 1, 15, 24), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run3 = SessionSimulator() friPm8Run3.create('Fri pm Boarder X 1/8 #3', datetime(2000, 1, 1, 15, 24), datetime(2000, 1, 1, 15, 28), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run4 = SessionSimulator() friPm8Run4.create('Fri pm Boarder X 1/8 #4', datetime(2000, 1, 1, 15, 28), datetime(2000, 1, 1, 15, 32), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run5 = SessionSimulator() friPm8Run5.create('Fri pm Boarder X 1/8 #5', datetime(2000, 1, 1, 15, 32), datetime(2000, 1, 1, 15, 36), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run6 = SessionSimulator() friPm8Run6.create('Fri pm Boarder X 1/8 #6', datetime(2000, 1, 1, 15, 36), datetime(2000, 1, 1, 15, 40), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run7 = SessionSimulator() friPm8Run7.create('Fri pm Boarder X 1/8 #7', datetime(2000, 1, 1, 15, 40), datetime(2000, 1, 1, 15, 44), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm8Run8 = SessionSimulator() friPm8Run8.create('Fri pm Boarder X 1/8 #8', datetime(2000, 1, 1, 15, 44), datetime(2000, 1, 1, 15, 48), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPm8Sessions = [ friPm8Run1, friPm8Run2, friPm8Run3, friPm8Run4, friPm8Run5, friPm8Run6, friPm8Run7, friPm8Run8 ] def createPm4Sessions(self): friPm4Run1 = SessionSimulator() friPm4Run1.create('Fri pm Boarder X 1/4 #1', datetime(2000, 1, 1, 16, 0), datetime(2000, 1, 1, 16, 4), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm4Run2 = SessionSimulator() friPm4Run2.create('Fri pm Boarder X 1/4 #2', datetime(2000, 1, 1, 16, 4), datetime(2000, 1, 1, 16, 8), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm4Run3 = SessionSimulator() friPm4Run3.create('Fri pm Boarder X 1/4 #3', datetime(2000, 1, 1, 16, 8), datetime(2000, 1, 1, 16, 12), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPm4Run4 = SessionSimulator() friPm4Run4.create('Fri pm Boarder X 1/4 #4', datetime(2000, 1, 1, 16, 12), datetime(2000, 1, 1, 16, 16), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPm4Sessions = [friPm4Run1, friPm4Run2, friPm4Run3, friPm4Run4] def createPmSemiSessions(self): friPmSemiRun1 = SessionSimulator() friPmSemiRun1.create('Fri pm Boarder X 1/2 #1', datetime(2000, 1, 1, 16, 30), datetime(2000, 1, 1, 16, 34), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) friPmSemiRun2 = SessionSimulator() friPmSemiRun2.create('Fri pm Boarder X 1/2 #2', datetime(2000, 1, 1, 16, 34), datetime(2000, 1, 1, 16, 38), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) self.friPmSemiSessions = [friPmSemiRun1, friPmSemiRun2] def createPmFinale(self): self.friPmFinale = SessionSimulator() self.friPmFinale.create('Fri pm Boarder X Finale', datetime(2000, 1, 1, 16, 45), datetime(2000, 1, 1, 17, 0), 'rc', self.boarderCross, self.event, self.chronos, self.beacons) def test(self): # ------------------------------------- #vendredi apres midi boarder cross boarder cross départ à 4 ou 6 ? ? # Quel ordre de départ? Comment sont déterminés les groupes? # ------------------------------------- # -- 1/16 th - 16 x 5 print("---- 1 / 16 th ----") # Order from results of morning morningChrono = getSessionByName('Friday am Chrono') friMorningChronoResults = getResultsForSession(morningChrono['id']) for i in range(0, 80): session = self.friPm16Sessions[(i % 16)] session.addPilot(friMorningChronoResults[i]['pilot']) sessionIndex = 0 for s in self.friPm16Sessions: session = s.session # We keep best s.startSession() s.simRace(2, 30, self.chronos[-1]['id'], 0) s.endSession() sessionIndex += 1 friPm16SessionsResults = [] for s in self.friPm16Sessions: sessionResults = getResultsForSession(s.session['id']) friPm16SessionsResults.append(sessionResults) print("---- Tests Results of " + s.session['name'] + "----") checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkResults(sessionResults, 5, {1: 5}, {1: 5}) # -- 1/8 th - 8 x 6 print("---- 1 / 8 th ----") sessionIndex = 0 for s in self.friPm8Sessions: session = s.session # We keep best addBestsOfSessions(friPm16SessionsResults[2 * sessionIndex], friPm16SessionsResults[(2 * sessionIndex) + 1], 3, s) s.startSession() s.simRace(2, 30, self.chronos[-1]['id'], 1) # We forget to end that one # s.endSession() sessionIndex += 1 friPm8SessionsResults = [] for s in self.friPm8Sessions: sessionResults = getResultsForSession(s.session['id']) friPm8SessionsResults.append(sessionResults) print("---- Tests Results of " + s.session['name'] + "----") checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) # Because we skipped the endSession, the unfinished laps still looks ongoing checkResults(sessionResults, 6, {1: 6}, {1: 6}) # -- 1/4 th - 4 x 6 print("---- 1 / 4 th ----") sessionIndex = 0 for s in self.friPm4Sessions: session = s.session # We keep best addBestsOfSessions(friPm8SessionsResults[2 * sessionIndex], friPm8SessionsResults[(2 * sessionIndex) + 1], 3, s) s.startSession() s.simRace(2, 30, self.chronos[-1]['id'], 1) s.endSession() sessionIndex += 1 friPm4SessionsResults = [] for s in self.friPm4Sessions: sessionResults = getResultsForSession(s.session['id']) friPm4SessionsResults.append(sessionResults) print("---- Tests Results of " + s.session['name'] + "----") checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkResults(sessionResults, 6, {1: 5}, {1: 5}) # -- 1/2 th - 2 x 6 print("---- 1 / 2 th ----") sessionIndex = 0 for s in self.friPmSemiSessions: session = s.session # We keep best addBestsOfSessions(friPm4SessionsResults[2 * sessionIndex], friPm4SessionsResults[(2 * sessionIndex) + 1], 3, s) s.startSession() s.simRace(2, 30, self.chronos[-1]['id'], 1) s.endSession() sessionIndex += 1 friPmSemiSessionsResults = [] for s in self.friPmSemiSessions: sessionResults = getResultsForSession(s.session['id']) friPmSemiSessionsResults.append(sessionResults) print("---- Tests Results of " + s.session['name'] + "----") checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5}, {1: 5}) checkResults(sessionResults, 6, {1: 5}, {1: 5}) # -- Finale - 1 x 6 print("---- Finale ----") # We keep best addBestsOfSessions(friPmSemiSessionsResults[0], friPmSemiSessionsResults[1], 3, self.friPmFinale) self.friPmFinale.startSession() self.friPmFinale.simRace(2, 30, self.chronos[-1]['id']) self.friPmFinale.endSession() print("---- Tests Results of " + self.friPmFinale.session['name'] + "----") checkLaps(getLapsForSession(self.friPmFinale.session['id']), 6, {1: 6}, {1: 6}) checkBestLaps(getBestLapsForSession(self.friPmFinale.session['id']), 6, {1: 6}, {1: 6}) checkResults(getResultsForSession(self.friPmFinale.session['id']), 6, {1: 6}, {1: 6})
class FridayMorningTest: def __init__(self, championship): self.championship = championship self.morningTest = SessionSimulator() self.morningChrono = SessionSimulator() self.boarderCross = self.championship.boarderCross self.fake1 = self.championship.fake1 self.chrono = self.championship.chrono self.beacons = self.championship.beacons def createSessions(self): # Add sessions print("---- Create session of Friday morning ----") s1 = datetime(2000, 1, 1, 10) e1 = datetime(2000, 1, 1, 11) event = self.championship.event location = self.boarderCross chronos = [self.fake1, self.chrono] pilots = self.championship.allPilots self.morningTest.create('Friday am tests', s1, e1, 'tt', location, event, chronos, self.beacons, pilots) s2 = datetime(2000, 1, 1, 11) e2 = datetime(2000, 1, 1, 12) self.morningChrono.create('Friday am Chrono', s2, e2, 'tt', location, event, chronos, self.beacons) def test(self): self.borderCrossQP() self.borderCrossChronos() def borderCrossQP(self): # descente dans le boarder cross # Border cross # deux runs d essais (controle transpondeurs) # deux runs chronos # le meilleur retenu print("---- Test #1 ----") self.morningTest.startSession() self.morningTest.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], doNotStart=1, doNotFinish=1) print("---- Test #2 ----") self.morningTest.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], doNotStart=2, doNotFinish=2, startShift=30) # We forget to stop that one self.morningTest.endSession() print("---- Tests Results ----") friMorningTestsLaps = getLapsForSession(self.morningTest.session['id']) checkLaps(friMorningTestsLaps, 160 - 6, {1: 78, 2: 76}, {1: 2}) friMorningTestsLapsElite = getLapsForSession( self.morningTest.session['id'], self.championship.eliteCategory['id']) checkLaps(friMorningTestsLapsElite, 60 - 6, { 1: 28, 2: 26 }, {1: 2}, self.championship.eliteCategory['name']) friMorningTestsBests = getBestLapsForSession( self.morningTest.session['id']) printLaps(friMorningTestsBests, True) checkBestLaps(friMorningTestsBests, 78, {}, {1: 2}) # ---- Determine startup ---- friMorningTestsResults = getResultsForSession( self.morningTest.session['id']) # TODO Have chart with startup list # TODO Check if it should count points checkResults(friMorningTestsResults, 80, {}, {1: 4}) beaconsStartOrder = [] for i in reversed(range(30)): self.morningChrono.addPilot(friMorningTestsResults[i]['pilot']) for i in range(30, 80): self.morningChrono.addPilot(friMorningTestsResults[i]['pilot']) def borderCrossChronos(self): # Some do 1 test # Some dont test # Some start but dont finish # Some finish after expected time print("---- Chrono #1 ----") self.morningChrono.startSession() self.morningChrono.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], doNotStart=1, doNotFinish=1, startShift=10) print("---- Chrono #2 ----") self.morningChrono.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], doNotStart=2, doNotFinish=2, startShift=45) self.morningTest.endSession() print("---- Chrono Results ----") # ---- Results ---- # ---- Checks - Asserts ---- friMorningChronoLaps = getLapsForSession( self.morningChrono.session['id']) checkLaps(friMorningChronoLaps, 160 - 6, {1: 78, 2: 76}, {1: 2}) friMorningChronoBests = getBestLapsForSession( self.morningChrono.session['id']) checkBestLaps(friMorningChronoBests, 78, {}, {1: 2}) friMorningChronoResults = getResultsForSession( self.morningChrono.session['id']) checkResults(friMorningChronoResults, 80, {}, {1: 4})
class SaturdayAfternoonTest: def __init__(self, championship): self.championship = championship self.qualification = SessionSimulator() self.sessions32 = [] self.sessions16 = [] self.sessions8 = [] self.sessions4 = [] self.sessions2 = [] self.finale = None self.dual = self.championship.dual self.fake1 = self.championship.fake1 self.chrono = self.championship.chrono self.beacons = self.championship.beacons self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.eliteCategory = self.championship.eliteCategory self.openCategory = self.championship.openCategory self.womanCategory = self.championship.womanCategory self.juniorCategory = self.championship.juniorCategory def createSessions(self): # Add sessions print("---- Create session of Saturday afternoon ----") s1 = datetime(2000, 1, 2, 14) e1 = datetime(2000, 1, 2, 15) event = self.championship.event location = self.dual chronos = [self.fake1, self.chrono] pilots = self.championship.allPilots self.qualification.create('Saturday pm qualification', s1, e1, 'tt', location, event, chronos, self.beacons, pilots) for i in range(1, 33): sessions32_i = SessionSimulator() name = "Sat pm dual 32th #" + str(i) h, m = divmod(i * 2, 60) eh, em = divmod(i * 2 + 2, 60) sessions32_i.create(name, datetime(2000, 1, 2, 16 + h, m), datetime(2000, 1, 1, 16 + eh, em), 'rc', location, event, chronos, self.beacons) self.sessions32.append(sessions32_i) for i in range(1, 17): name = 'Sat pm dual 16th #' + str(i) sessions16_i = SessionSimulator() sessions16_i.create(name, datetime(2000, 1, 2, 17, 20 + i * 2), datetime(2000, 1, 1, 17, 22 + i * 2), 'rc', location, event, chronos, self.beacons) self.sessions16.append(sessions16_i) for i in range(1, 9): name = 'Sat pm dual 8th #' + str(i) sessions8_i = SessionSimulator() sessions8_i.create(name, datetime(2000, 1, 2, 18, i * 2), datetime(2000, 1, 1, 18, i * 2 + 2), 'rc', location, event, chronos, self.beacons) self.sessions8.append(sessions8_i) for i in range(1, 5): name = 'Sat pm dual 4th #' + str(i) sessions4_i = SessionSimulator() sessions4_i.create(name, datetime(2000, 1, 2, 18, 30 + i * 2), datetime(2000, 1, 1, 15, 32 + i * 2 + 2), 'rc', location, event, chronos, self.beacons) self.sessions4.append(sessions4_i) for i in range(1, 3): name = 'Sat pm dual 2th #' + str(i) sessions2_i = SessionSimulator() sessions2_i.create(name, datetime(2000, 1, 2, 19, i * 2), datetime(2000, 1, 1, 19, i * 2 + 2), 'rc', location, event, chronos, self.beacons) self.sessions2.append(sessions2_i) self.finale = SessionSimulator() self.finale.create('Sat pm dual finale', datetime(2000, 1, 2, 19, 30), datetime(2000, 1, 1, 19, 32), 'rc', location, event, chronos, self.beacons) def test(self): bestLaps = self.qualify() qualifiedNext = self.runSessions(bestLaps, self.sessions32) qualifiedNext = self.runSessions(qualifiedNext, self.sessions16) qualifiedNext = self.runSessions(qualifiedNext, self.sessions8) qualifiedNext = self.runSessions(qualifiedNext, self.sessions4) qualifiedNext = self.runSessions(qualifiedNext, self.sessions2) self.runSessions(qualifiedNext, [self.finale]) def runFinale(self, qualified): print("---- Dual Finale ----") def runSessions(self, qualified, sessions): results = [] print("---- Dual " + str(len(sessions)) + "th finale ----") for i in range(0, len(sessions)): session = sessions[i] session.addPilot(qualified[2 * i]['pilot']) session.addPilot(qualified[2 * i + 1]['pilot']) session.startSession() session.simRace(1, 10, self.chrono['id'], 0) session.endSession() # We keep winner sessionResults = getResultsForSession(session.session['id']) results.append(sessionResults[0]) print("---- Tests Results of " + session.session['name'] + "----") checkLaps(getLapsForSession(session.session['id']), 2, {1: 2}, {1: 2}) checkBestLaps(getBestLapsForSession(session.session['id']), 2, {1: 2}, {1: 2}) checkResults(sessionResults, 2, {1: 2}, {1: 2}) return results def qualify(self): self.qualification.startSession() print("---- Test #1 ----") self.qualification.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id']) print("---- Test #2 ----") self.qualification.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], startShift=30) self.qualification.endSession() print("---- Tests Results (general) ----") bestLaps = getBestLapsForSession(self.qualification.session['id']) checkBestLaps(bestLaps, 80, {}, {}) print("---- Tests Results (Elite) ----") bestLapsElite = getBestLapsForSession(self.qualification.session['id'], self.eliteCategory['id']) checkBestLaps(bestLapsElite, len(self.elitePilots), {}, {}, 'Elite', 120000, 140000) print("---- Tests Results (Open) ----") bestLapsOpen = getBestLapsForSession(self.qualification.session['id'], self.openCategory['id']) checkBestLaps(bestLapsOpen, len(self.openPilots), {}, {}, 'Open', 120000, 140000) print("---- Tests Results (Women) ----") bestLapsWomen = getBestLapsForSession(self.qualification.session['id'], self.womanCategory['id']) checkBestLaps(bestLapsWomen, len(self.womanPilots), {}, {}, 'Woman', 120000, 140000) print("---- Tests Results (Junior) ----") bestLapsJunior = getBestLapsForSession(self.qualification.session['id'], self.juniorCategory['id']) checkBestLaps(bestLapsJunior, len(self.juniorPilots), {}, {}, 'Junior', 120000, 140000) # Find the 64 participants qualified = bestLapsElite[0:24] + bestLapsOpen[0:16] + bestLapsWomen[0:16] + bestLapsJunior[0:8] return qualified
def createSessions(self): # Add sessions print("---- Create session of Saturday afternoon ----") s1 = datetime(2000, 1, 2, 14) e1 = datetime(2000, 1, 2, 15) event = self.championship.event location = self.dual chronos = [self.fake1, self.chrono] pilots = self.championship.allPilots self.qualification.create('Saturday pm qualification', s1, e1, 'tt', location, event, chronos, self.beacons, pilots) for i in range(1, 33): sessions32_i = SessionSimulator() name = "Sat pm dual 32th #" + str(i) h, m = divmod(i * 2, 60) eh, em = divmod(i * 2 + 2, 60) sessions32_i.create(name, datetime(2000, 1, 2, 16 + h, m), datetime(2000, 1, 1, 16 + eh, em), 'rc', location, event, chronos, self.beacons) self.sessions32.append(sessions32_i) for i in range(1, 17): name = 'Sat pm dual 16th #' + str(i) sessions16_i = SessionSimulator() sessions16_i.create(name, datetime(2000, 1, 2, 17, 20 + i * 2), datetime(2000, 1, 1, 17, 22 + i * 2), 'rc', location, event, chronos, self.beacons) self.sessions16.append(sessions16_i) for i in range(1, 9): name = 'Sat pm dual 8th #' + str(i) sessions8_i = SessionSimulator() sessions8_i.create(name, datetime(2000, 1, 2, 18, i * 2), datetime(2000, 1, 1, 18, i * 2 + 2), 'rc', location, event, chronos, self.beacons) self.sessions8.append(sessions8_i) for i in range(1, 5): name = 'Sat pm dual 4th #' + str(i) sessions4_i = SessionSimulator() sessions4_i.create(name, datetime(2000, 1, 2, 18, 30 + i * 2), datetime(2000, 1, 1, 15, 32 + i * 2 + 2), 'rc', location, event, chronos, self.beacons) self.sessions4.append(sessions4_i) for i in range(1, 3): name = 'Sat pm dual 2th #' + str(i) sessions2_i = SessionSimulator() sessions2_i.create(name, datetime(2000, 1, 2, 19, i * 2), datetime(2000, 1, 1, 19, i * 2 + 2), 'rc', location, event, chronos, self.beacons) self.sessions2.append(sessions2_i) self.finale = SessionSimulator() self.finale.create('Sat pm dual finale', datetime(2000, 1, 2, 19, 30), datetime(2000, 1, 1, 19, 32), 'rc', location, event, chronos, self.beacons)
class SaturdayMorningTest: def __init__(self, championship): self.championship = championship self.fake1 = self.championship.fake1 self.chrono = self.championship.chrono self.beacons = self.championship.beacons self.allPilots = self.championship.allPilots self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.mercantour = self.championship.mercantour self.satDerby1Elite = SessionSimulator() self.satDerby1Open = SessionSimulator() self.satDerby1Woman = SessionSimulator() self.satDerby1Junior = SessionSimulator() def createSessions(self): # Add sessions print("---- Create session of Saturday morning ----") chronos = [self.fake1, self.chrono] self.satDerby1Elite.create('Sat Derby 1 - Elite', datetime(2000, 1, 2, 10, 5), datetime(2000, 1, 2, 10, 10), 'rc', self.mercantour, self.championship.event, chronos, self.beacons, self.elitePilots) self.satDerby1Open.create('Sat Derby 1 - Open', datetime(2000, 1, 2, 10, 15), datetime(2000, 1, 2, 10, 20), 'rc', self.mercantour, self.championship.event, chronos, self.beacons, self.openPilots) self.satDerby1Woman.create('Sat Derby 1 - Woman', datetime(2000, 1, 2, 10, 25), datetime(2000, 1, 2, 10, 30), 'rc', self.mercantour, self.championship.event, chronos, self.beacons, self.womanPilots) self.satDerby1Junior.create('Sat Derby 1 - Junior', datetime(2000, 1, 2, 10, 35), datetime(2000, 1, 2, 10, 40), 'rc', self.mercantour, self.championship.event, chronos, self.beacons, self.juniorPilots) def test(self): self.satDerby1Elite.startSession() self.satDerby1Elite.simRace(3, 10, self.chrono['id']) self.satDerby1Elite.endSession() print("---- Tests Results of " + self.satDerby1Elite.session['name'] + "----") checkLaps(getLapsForSession(self.satDerby1Elite.session['id']), len(self.elitePilots), {1: len(self.elitePilots)}, {1: len(self.elitePilots)}, 'Elite', 180000, 190000) checkBestLaps(getBestLapsForSession(self.satDerby1Elite.session['id']), len(self.elitePilots), {1: len(self.elitePilots)}, {1: len(self.elitePilots)}, 'Elite', 180000, 190000) checkResults(getResultsForSession(self.satDerby1Elite.session['id']), len(self.elitePilots), {1: len(self.elitePilots)}, {1: len(self.elitePilots)}, 'Elite', 180000, 190000) self.satDerby1Open.startSession() self.satDerby1Open.simRace(3, 20, self.chrono['id']) self.satDerby1Open.endSession() print("---- Tests Results of " + self.satDerby1Open.session['name'] + "----") checkLaps(getLapsForSession(self.satDerby1Open.session['id']), len(self.openPilots), {1: len(self.openPilots)}, {1: len(self.openPilots)}, 'Open', 180000, 200000) checkBestLaps(getBestLapsForSession(self.satDerby1Open.session['id']), len(self.openPilots), {1: len(self.openPilots)}, {1: len(self.openPilots)}, 'Open', 180000, 200000) checkResults(getResultsForSession(self.satDerby1Open.session['id']), len(self.openPilots), {1: len(self.openPilots)}, {1: len(self.openPilots)}, 'Open', 180000, 200000) self.satDerby1Woman.startSession() self.satDerby1Woman.simRace(3, 30, self.chrono['id']) self.satDerby1Woman.endSession() checkLaps(getLapsForSession(self.satDerby1Woman.session['id']), len(self.womanPilots), {1: len(self.womanPilots)}, {1: len(self.womanPilots)}, 'Woman', 180000, 210000) checkBestLaps(getBestLapsForSession(self.satDerby1Woman.session['id']), len(self.womanPilots), {1: len(self.womanPilots)}, {1: len(self.womanPilots)}, 'Woman', 180000, 210000) checkResults(getResultsForSession(self.satDerby1Woman.session['id']), len(self.womanPilots), {1: len(self.womanPilots)}, {1: len(self.womanPilots)}, 'Woman', 180000, 210000) self.satDerby1Junior.startSession() self.satDerby1Junior.simRace(3, 40, self.chrono['id']) self.satDerby1Junior.endSession() checkLaps(getLapsForSession(self.satDerby1Junior.session['id']), len(self.juniorPilots), {1: len(self.juniorPilots)}, {1: len(self.juniorPilots)}, 'Junior', 180000, 220000) checkBestLaps( getBestLapsForSession(self.satDerby1Junior.session['id']), len(self.juniorPilots), {1: len(self.juniorPilots)}, {1: len(self.juniorPilots)}, 'Junior', 180000, 220000) checkResults(getResultsForSession(self.satDerby1Junior.session['id']), len(self.juniorPilots), {1: len(self.juniorPilots)}, {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
def __init__(self, championship): self.championship = championship self.fake1 = self.championship.fake1 self.fake2 = self.championship.fake2 self.chrono = self.championship.chrono self.beacons = self.championship.beacons self.allPilots = self.championship.allPilots self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.valette = self.championship.valette self.sunDerby2Elite = SessionSimulator() self.sunDerby2Open = SessionSimulator() self.sunDerby2Woman = SessionSimulator() self.sunDerby2Junior = SessionSimulator() self.redRiver = self.championship.redRiver self.roubines = self.championship.roubines self.sunDoubleRedRiver = SessionSimulator() self.sunDoubleRoubines = SessionSimulator()
class SundayMorningTest: def __init__(self, championship): self.championship = championship self.fake1 = self.championship.fake1 self.fake2 = self.championship.fake2 self.chrono = self.championship.chrono self.beacons = self.championship.beacons self.allPilots = self.championship.allPilots self.elitePilots = self.championship.elitePilots self.openPilots = self.championship.openPilots self.womanPilots = self.championship.womanPilots self.juniorPilots = self.championship.juniorPilots self.valette = self.championship.valette self.sunDerby2Elite = SessionSimulator() self.sunDerby2Open = SessionSimulator() self.sunDerby2Woman = SessionSimulator() self.sunDerby2Junior = SessionSimulator() self.redRiver = self.championship.redRiver self.roubines = self.championship.roubines self.sunDoubleRedRiver = SessionSimulator() self.sunDoubleRoubines = SessionSimulator() def createSessions(self): # Add sessions print("---- Create session of Sunday morning ----") valette = self.valette event = self.championship.event beacons = self.beacons chronos = [self.fake1, self.chrono] self.sunDerby2Elite.create('Sun Derby 2 - Elite', datetime(2000, 1, 3, 10, 5), datetime(2000, 1, 3, 10, 10), 'rc', valette, event, chronos, beacons, self.elitePilots) self.sunDerby2Open.create('Sun Derby 2 - Open', datetime(2000, 1, 3, 10, 15), datetime(2000, 1, 3, 10, 20), 'rc', valette, event, chronos, beacons, self.openPilots) self.sunDerby2Woman.create('Sun Derby 2 - Woman', datetime(2000, 1, 3, 10, 25), datetime(2000, 1, 3, 10, 30), 'rc', valette, event, chronos, beacons, self.womanPilots) self.sunDerby2Junior.create('Sun Derby 2 - Junior', datetime(2000, 1, 3, 10, 35), datetime(2000, 1, 3, 10, 40), 'rc', valette, event, chronos, beacons, self.juniorPilots) chronos2 = [self.fake2, self.chrono] redRiver = self.redRiver roubines = self.roubines allPilots = self.allPilots self.sunDoubleRedRiver.create('Sun Double - Red River', datetime(2000, 1, 3, 11, 0), datetime(2000, 1, 3, 13, 00), 'tt', redRiver, event, chronos, beacons, allPilots) self.sunDoubleRoubines.create('Sun Double - Roubines', datetime(2000, 1, 3, 11, 0), datetime(2000, 1, 3, 13, 00), 'tt', roubines, event, chronos2, beacons, allPilots) def test(self): self.testDerby() self.testDouble() def testDouble(self): print("---- Double of Sunday morning ----") print("-- First runs") self.sunDoubleRedRiver.startSession() self.sunDoubleRoubines.startSession() print(" Elite and Junior run in Red River") self.sunDoubleRedRiver.pilots = self.elitePilots + self.juniorPilots self.sunDoubleRedRiver.simTimeTrial(3, 59, 10, self.fake1['id'], self.chrono['id']) print(" Open and Women run in Roubines") self.sunDoubleRoubines.pilots = self.openPilots + self.womanPilots self.sunDoubleRoubines.simTimeTrial(3, 59, 10, self.fake2['id'], self.chrono['id']) print(" Open and Women run in Red River") self.sunDoubleRedRiver.pilots = self.openPilots + self.womanPilots self.sunDoubleRedRiver.simTimeTrial(3, 59, 10, self.fake1['id'], self.chrono['id'], startShift=20) print(" Elite and Junior run in Roubines") self.sunDoubleRoubines.pilots = self.elitePilots + self.juniorPilots self.sunDoubleRoubines.simTimeTrial(3, 59, 10, self.fake2['id'], self.chrono['id'], startShift=20) print("-- Second runs") print(" Elite improve in Red River") self.sunDoubleRedRiver.pilots = self.elitePilots self.sunDoubleRedRiver.simTimeTrial(2, 59, 10, self.fake1['id'], self.chrono['id'], startShift=45) print(" Open dont improve in Red River") self.sunDoubleRedRiver.pilots = self.openPilots self.sunDoubleRedRiver.simTimeTrial(4, 59, 10, self.fake1['id'], self.chrono['id'], startShift=60) print(" Women improve in Roubines") self.sunDoubleRoubines.pilots = self.womanPilots self.sunDoubleRoubines.simTimeTrial(2, 59, 10, self.fake2['id'], self.chrono['id'], startShift=45) print(" Junior dont improve in Roubines") self.sunDoubleRoubines.pilots = self.juniorPilots self.sunDoubleRoubines.simTimeTrial(4, 59, 10, self.fake2['id'], self.chrono['id'], startShift=60) self.sunDoubleRedRiver.endSession() self.sunDoubleRoubines.endSession() print("---- Tests Results (general) ----") bestLapsRedRiver = getBestLaps(self.redRiver['id']) bestLapsRoubines = getBestLaps(self.roubines['id']) checkBestLaps(bestLapsRedRiver, 80, { 2: 30, 1: 50 }, { 1: 30, 2: 50 }, None, 120000, 240000) checkBestLaps(bestLapsRoubines, 80, { 2: 20, 1: 60 }, { 1: 50, 2: 30 }, None, 120000, 240000) def testDerby(self): print("---- Derby of Sunday morning ----") self.sunDerby2Elite.startSession() self.sunDerby2Elite.simRace(3, 10, self.chrono['id']) self.sunDerby2Elite.endSession() print("---- Tests Results of " + self.sunDerby2Elite.session['name'] + "----") checkLaps(getLapsForSession(self.sunDerby2Elite.session['id']), len(self.elitePilots), {1: len(self.elitePilots)}, {1: len(self.elitePilots)}, 'Elite', 180000, 190000) checkBestLaps(getBestLapsForSession(self.sunDerby2Elite.session['id']), len(self.elitePilots), {1: len(self.elitePilots)}, {1: len(self.elitePilots)}, 'Elite', 180000, 190000) checkResults(getResultsForSession(self.sunDerby2Elite.session['id']), len(self.elitePilots), {1: len(self.elitePilots)}, {1: len(self.elitePilots)}, 'Elite', 180000, 190000) self.sunDerby2Open.startSession() self.sunDerby2Open.simRace(3, 20, self.chrono['id']) # We forget to end that one #self.sunDerby2Open.endSession() print("---- Tests Results of " + self.sunDerby2Open.session['name'] + "----") checkLaps(getLapsForSession(self.sunDerby2Open.session['id']), len(self.openPilots), {1: len(self.openPilots)}, {1: len(self.openPilots)}, 'Open', 180000, 200000) checkBestLaps(getBestLapsForSession(self.sunDerby2Open.session['id']), len(self.openPilots), {1: len(self.openPilots)}, {1: len(self.openPilots)}, 'Open', 180000, 200000) checkResults(getResultsForSession(self.sunDerby2Open.session['id']), len(self.openPilots), {1: len(self.openPilots)}, {1: len(self.openPilots)}, 'Open', 180000, 200000) self.sunDerby2Woman.startSession() self.sunDerby2Woman.simRace(3, 30, self.chrono['id']) self.sunDerby2Woman.endSession() checkLaps(getLapsForSession(self.sunDerby2Woman.session['id']), len(self.womanPilots), {1: len(self.womanPilots)}, {1: len(self.womanPilots)}, 'Woman', 180000, 210000) checkBestLaps(getBestLapsForSession(self.sunDerby2Woman.session['id']), len(self.womanPilots), {1: len(self.womanPilots)}, {1: len(self.womanPilots)}, 'Woman', 180000, 210000) checkResults(getResultsForSession(self.sunDerby2Woman.session['id']), len(self.womanPilots), {1: len(self.womanPilots)}, {1: len(self.womanPilots)}, 'Woman', 180000, 210000) self.sunDerby2Junior.startSession() self.sunDerby2Junior.simRace(3, 40, self.chrono['id']) self.sunDerby2Junior.endSession() checkLaps(getLapsForSession(self.sunDerby2Junior.session['id']), len(self.juniorPilots), {1: len(self.juniorPilots)}, {1: len(self.juniorPilots)}, 'Junior', 180000, 220000) checkBestLaps( getBestLapsForSession(self.sunDerby2Junior.session['id']), len(self.juniorPilots), {1: len(self.juniorPilots)}, {1: len(self.juniorPilots)}, 'Junior', 180000, 220000) checkResults(getResultsForSession(self.sunDerby2Junior.session['id']), len(self.juniorPilots), {1: len(self.juniorPilots)}, {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)