Skip to content

Commit 9f6a494

Browse files
committed
test: deduplicate pytest params for problem 550
1 parent 6f7fb0f commit 9f6a494

File tree

2 files changed

+47
-44
lines changed

2 files changed

+47
-44
lines changed

tests/test_pandas.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -73,50 +73,7 @@ def test_problem_197(input_data, expected_data):
7373

7474
@pytest.mark.parametrize(
7575
"input_data, expected_data",
76-
[
77-
pytest.param(
78-
{
79-
"player_id": [1, 1, 2, 3, 3],
80-
"device_id": [2, 2, 3, 1, 4],
81-
"event_date": [
82-
datetime(2016, 3, 1),
83-
datetime(2016, 3, 2),
84-
datetime(2017, 6, 25),
85-
datetime(2016, 3, 2),
86-
datetime(2018, 7, 3),
87-
],
88-
"games_played": [5, 6, 1, 0, 5],
89-
},
90-
{"fraction": [0.33]},
91-
id="happy_path_basic",
92-
),
93-
pytest.param(
94-
{
95-
"player_id": [1, 1, 1, 2, 2],
96-
"device_id": [2, 2, 3, 1, 4],
97-
"event_date": [
98-
datetime(2023, 1, 1),
99-
datetime(2023, 1, 2),
100-
datetime(2023, 1, 3),
101-
datetime(2023, 1, 1),
102-
datetime(2023, 1, 2),
103-
],
104-
"games_played": [1, 2, 3, 4, 5],
105-
},
106-
{"fraction": [1.0]},
107-
id="happy_path_multiple_dates",
108-
),
109-
pytest.param(
110-
{
111-
"player_id": [1],
112-
"device_id": [1],
113-
"event_date": [datetime(2023, 1, 1)],
114-
"games_played": [1],
115-
},
116-
{"fraction": [0.0]},
117-
id="edge_case_single_entry",
118-
),
119-
],
76+
PARAMS_PROBLEM_550,
12077
)
12178
def test_problem_550(input_data, expected_data):
12279
table = pd.DataFrame(input_data)

tests/test_problem_params.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,49 @@
197197
id="skip_a_day",
198198
),
199199
]
200+
201+
202+
PARAMS_PROBLEM_550 = [
203+
pytest.param(
204+
{
205+
"player_id": [1, 1, 2, 3, 3],
206+
"device_id": [2, 2, 3, 1, 4],
207+
"event_date": [
208+
datetime(2016, 3, 1),
209+
datetime(2016, 3, 2),
210+
datetime(2017, 6, 25),
211+
datetime(2016, 3, 2),
212+
datetime(2018, 7, 3),
213+
],
214+
"games_played": [5, 6, 1, 0, 5],
215+
},
216+
{"fraction": [0.33]},
217+
id="happy_path_basic",
218+
),
219+
pytest.param(
220+
{
221+
"player_id": [1, 1, 1, 2, 2],
222+
"device_id": [2, 2, 3, 1, 4],
223+
"event_date": [
224+
datetime(2023, 1, 1),
225+
datetime(2023, 1, 2),
226+
datetime(2023, 1, 3),
227+
datetime(2023, 1, 1),
228+
datetime(2023, 1, 2),
229+
],
230+
"games_played": [1, 2, 3, 4, 5],
231+
},
232+
{"fraction": [1.0]},
233+
id="happy_path_multiple_dates",
234+
),
235+
pytest.param(
236+
{
237+
"player_id": [1],
238+
"device_id": [1],
239+
"event_date": [datetime(2023, 1, 1)],
240+
"games_played": [1],
241+
},
242+
{"fraction": [0.0]},
243+
id="edge_case_single_entry",
244+
),
245+
]

0 commit comments

Comments
 (0)