Code Duplication    Length = 18-18 lines in 4 locations

tests/test_timer.py 4 locations

@@ 187-204 (lines=18) @@
184
    assert color == timer.third_color
185
186
187
def test_user_finished_other(random_users):
188
    entrant = get_test_entrant(
189
        next(random_users), status_value="finished",
190
        finished_at=datetime.now(timezone.utc), place=5,
191
        finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1)
192
    )
193
    entrants = get_test_entrants(random_users, entrant)
194
    race = get_test_race(
195
        started_at=datetime.now(timezone.utc)-entrant.finish_time,
196
        entrants_count=5, entrants=entrants
197
    )
198
    timer = get_test_timer()
199
    color, text = timer.get_timer_text(race, entrant.user.full_name)
200
    assert color is None
201
    assert text == "1:09:42.0"
202
    timer.use_podium_colors = True
203
    color, text = timer.get_timer_text(race, entrant.user.full_name)
204
    assert color == timer.finished_color
205
@@ 167-184 (lines=18) @@
164
    assert color == timer.second_color
165
166
167
def test_user_finished_third(random_users):
168
    entrant = get_test_entrant(
169
        next(random_users), status_value="finished",
170
        finished_at=datetime.now(timezone.utc), place=3,
171
        finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1)
172
    )
173
    entrants = get_test_entrants(random_users, entrant)
174
    race = get_test_race(
175
        started_at=datetime.now(timezone.utc)-entrant.finish_time,
176
        entrants_count=5, entrants=entrants
177
    )
178
    timer = get_test_timer()
179
    color, text = timer.get_timer_text(race, entrant.user.full_name)
180
    assert color is None
181
    assert text == "1:09:42.0"
182
    timer.use_podium_colors = True
183
    color, text = timer.get_timer_text(race, entrant.user.full_name)
184
    assert color == timer.third_color
185
186
187
def test_user_finished_other(random_users):
@@ 147-164 (lines=18) @@
144
    assert color == timer.first_color
145
146
147
def test_user_finished_second(random_users):
148
    entrant = get_test_entrant(
149
        next(random_users), status_value="finished",
150
        finished_at=datetime.now(timezone.utc), place=2,
151
        finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1)
152
    )
153
    entrants = get_test_entrants(random_users, entrant)
154
    race = get_test_race(
155
        started_at=datetime.now(timezone.utc)-entrant.finish_time,
156
        entrants_count=5, entrants=entrants
157
    )
158
    timer = get_test_timer()
159
    color, text = timer.get_timer_text(race, entrant.user.full_name)
160
    assert color is None
161
    assert text == "1:09:42.0"
162
    timer.use_podium_colors = True
163
    color, text = timer.get_timer_text(race, entrant.user.full_name)
164
    assert color == timer.second_color
165
166
167
def test_user_finished_third(random_users):
@@ 127-144 (lines=18) @@
124
    assert color == timer.cancel_dq_color
125
126
127
def test_user_finished_first(random_users):
128
    entrant = get_test_entrant(
129
        next(random_users), status_value="finished",
130
        finished_at=datetime.now(timezone.utc), place=1,
131
        finish_time=timedelta(hours=1, minutes=9, seconds=42, microseconds=1)
132
    )
133
    entrants = get_test_entrants(random_users, entrant)
134
    race = get_test_race(
135
        started_at=datetime.now(timezone.utc)-entrant.finish_time,
136
        entrants_count=5, entrants=entrants
137
    )
138
    timer = get_test_timer()
139
    color, text = timer.get_timer_text(race, entrant.user.full_name)
140
    assert color is None
141
    assert text == "1:09:42.0"
142
    timer.use_podium_colors = True
143
    color, text = timer.get_timer_text(race, entrant.user.full_name)
144
    assert color == timer.first_color
145
146
147
def test_user_finished_second(random_users):