Code Duplication    Length = 10-10 lines in 5 locations

tests/test_timer.py 5 locations

@@ 161-170 (lines=10) @@
158
    color, text = timer.get_timer_text(race, entrant.user.full_name)
159
    assert color == timer.third_color
160
161
def test_user_finished_other():
162
    timer = get_test_timer()
163
    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)
164
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
165
    color, text = timer.get_timer_text(race, entrant.user.full_name)
166
    assert color is None
167
    assert text == "1:09:42.0"
168
    timer.use_podium_colors = True
169
    color, text = timer.get_timer_text(race, entrant.user.full_name)
170
    assert color == timer.finished_color
@@ 150-159 (lines=10) @@
147
    color, text = timer.get_timer_text(race, entrant.user.full_name)
148
    assert color == timer.second_color
149
150
def test_user_finished_first():
151
    timer = get_test_timer()
152
    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)
153
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
154
    color, text = timer.get_timer_text(race, entrant.user.full_name)
155
    assert color is None
156
    assert text == "1:09:42.0"
157
    timer.use_podium_colors = True
158
    color, text = timer.get_timer_text(race, entrant.user.full_name)
159
    assert color == timer.third_color
160
161
def test_user_finished_other():
162
    timer = get_test_timer()
@@ 139-148 (lines=10) @@
136
    color, text = timer.get_timer_text(race, entrant.user.full_name)
137
    assert color == timer.first_color
138
139
def test_user_finished_first():
140
    timer = get_test_timer()
141
    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)
142
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
143
    color, text = timer.get_timer_text(race, entrant.user.full_name)
144
    assert color is None
145
    assert text == "1:09:42.0"
146
    timer.use_podium_colors = True
147
    color, text = timer.get_timer_text(race, entrant.user.full_name)
148
    assert color == timer.second_color
149
150
def test_user_finished_first():
151
    timer = get_test_timer()
@@ 128-137 (lines=10) @@
125
    color, text = timer.get_timer_text(race, entrant.user.full_name)
126
    assert color == timer.cancel_dq_color
127
128
def test_user_finished_first():
129
    timer = get_test_timer()
130
    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)
131
    race = get_test_race(started_at=datetime.now(timezone.utc)-entrant.finish_time, entrant=entrant, entrants_count=5)
132
    color, text = timer.get_timer_text(race, entrant.user.full_name)
133
    assert color is None
134
    assert text == "1:09:42.0"
135
    timer.use_podium_colors = True
136
    color, text = timer.get_timer_text(race, entrant.user.full_name)
137
    assert color == timer.first_color
138
139
def test_user_finished_first():
140
    timer = get_test_timer()
@@ 85-94 (lines=10) @@
82
    assert color is timer.racing_color
83
84
85
def test_timer_midrace_w_entrant():
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=42, seconds=6.9))
88
    race = get_test_race(version=16, entrants_count=2, entrant=entrant)
89
    color, text = timer.get_timer_text(race, entrant.user.full_name)
90
    assert color is None
91
    assert text == "1:42:06.9"
92
    timer.use_podium_colors = True
93
    color, text = timer.get_timer_text(race, entrant.user.full_name)
94
    assert color == timer.racing_color
95
96
def test_timer_midrace_w_user_not_in_race():
97
    timer = get_test_timer()