Пример #1
0
  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, {0: 2}, {0: 2})
Пример #2
0
  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
Пример #3
0
    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'])
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
 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
Пример #7
0
    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})
Пример #8
0
 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)