Code Duplication    Length = 10-10 lines in 5 locations

tests/test_timer.py 5 locations

@@ 118-127 (lines=10) @@
115
    color, text = timer.get_timer_text(race, entrant.user.full_name)
116
    assert color == timer.third_color
117
118
def test_user_finished_other():
119
    timer = get_test_timer()
120
    entrant = get_test_entrant(status_value="finished", finished_at=datetime.now(timezone.utc), finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1), place=5)
121
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
122
    color, text = timer.get_timer_text(race, entrant.user.full_name)
123
    assert color is None
124
    assert text == "1:09:42.0"
125
    timer.use_podium_colors = True
126
    color, text = timer.get_timer_text(race, entrant.user.full_name)
127
    assert color == timer.finished_color
@@ 107-116 (lines=10) @@
104
    color, text = timer.get_timer_text(race, entrant.user.full_name)
105
    assert color == timer.second_color
106
107
def test_user_finished_first():
108
    timer = get_test_timer()
109
    entrant = get_test_entrant(status_value="finished", finished_at=datetime.now(timezone.utc), finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1), place=3)
110
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
111
    color, text = timer.get_timer_text(race, entrant.user.full_name)
112
    assert color is None
113
    assert text == "1:09:42.0"
114
    timer.use_podium_colors = True
115
    color, text = timer.get_timer_text(race, entrant.user.full_name)
116
    assert color == timer.third_color
117
118
def test_user_finished_other():
119
    timer = get_test_timer()
@@ 96-105 (lines=10) @@
93
    color, text = timer.get_timer_text(race, entrant.user.full_name)
94
    assert color == timer.first_color
95
96
def test_user_finished_first():
97
    timer = get_test_timer()
98
    entrant = get_test_entrant(status_value="finished", finished_at=datetime.now(timezone.utc), finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1), place=2)
99
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
100
    color, text = timer.get_timer_text(race, entrant.user.full_name)
101
    assert color is None
102
    assert text == "1:09:42.0"
103
    timer.use_podium_colors = True
104
    color, text = timer.get_timer_text(race, entrant.user.full_name)
105
    assert color == timer.second_color
106
107
def test_user_finished_first():
108
    timer = get_test_timer()
@@ 85-94 (lines=10) @@
82
    color, text = timer.get_timer_text(race, entrant.user.full_name)
83
    assert color == timer.cancel_dq_color
84
85
def test_user_finished_first():
86
    timer = get_test_timer()
87
    entrant = get_test_entrant(status_value="finished", finished_at=datetime.now(timezone.utc), finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1), place=1)
88
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
89
    color, text = timer.get_timer_text(race, entrant.user.full_name)
90
    assert color is None
91
    assert text == "1:09:42.0"
92
    timer.use_podium_colors = True
93
    color, text = timer.get_timer_text(race, entrant.user.full_name)
94
    assert color == timer.first_color
95
96
def test_user_finished_first():
97
    timer = get_test_timer()
@@ 42-51 (lines=10) @@
39
    assert color is timer.racing_color
40
41
42
def test_timer_midrace_w_entrant():
43
    timer = get_test_timer()
44
    entrant = get_test_entrant(status_value="finished", finished_at=datetime.now(timezone.utc), finish_time=timedelta(hours=1, minutes=42, seconds=6.9))
45
    race = get_test_race(version=16, entrants_count=2, entrant=entrant)
46
    color, text = timer.get_timer_text(race, entrant.user.full_name)
47
    assert color is None
48
    assert text == "1:42:06.9"
49
    timer.use_podium_colors = True
50
    color, text = timer.get_timer_text(race, entrant.user.full_name)
51
    assert color == timer.racing_color
52
53
def test_timer_midrace_w_user_not_in_race():
54
    timer = get_test_timer()