コード例 #1
0
def generate_race_result(result):
    columns = [
        "POSITION", "COD", "PILOTO         ", "VOLTAS", "TEMPO DE PROVA",
        "MELHOR VOLTA", "VELOCIDADE MEDIA", "DIFERENÇA PARA O GANHADOR"
    ]
    print(" - ".join(columns))
    for race in result.races:
        print(
            "{:<8d} - {} - {:<15s} - {:>6} - {:>14} - {:>12} - {:>16} - {:>25}"
            .format(race.position, race.pilot.code, race.pilot.name,
                    len(race.laps), utils.format_time(race.race_time),
                    race.best_lap.lap_time,
                    utils.format_decimal(race.race_speed_average),
                    utils.format_time(race.winner_difference)))
    print("Melhor volta da corrida: {} - {}: {}".format(
        result.best_lap.get("Pilot").code,
        result.best_lap.get("Pilot").name, result.best_lap.get("Time")))
コード例 #2
0
 def test_format_time(self):
     mock_time = "0:04:15.578000"
     seconds = 255
     microseconds = 578000
     expected_time = "4:15.578"
     # time = timedelta.strptime(mock_time,"%H:%M:%S.%f")
     time = timedelta(seconds=seconds, microseconds=microseconds)
     print(time)
     result_time = utils.format_time(time)
     self.assertEqual(expected_time, result_time)
コード例 #3
0
 def str_last_edited(self):
     return format_time(self.last_edited)
コード例 #4
0
 def str_created(self):
     return format_time(self.created)
コード例 #5
0
 def str_completed_at(self):
     from utils.utils import format_time
     return format_time(self.completed_at)
コード例 #6
0
 def str_created(self):
     from utils.utils import format_time
     return format_time(self.created)