Skip to content

Commit

Permalink
test: deduplicate pytest params for problem 1141
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek committed Jan 26, 2025
1 parent 6ed1195 commit e4c8c5a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 64 deletions.
33 changes: 1 addition & 32 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,38 +310,7 @@ def test_problem_1075(input_data_1, input_data_2, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"user_id": [1, 1, 1, 2, 2, 2],
"session_id": [1, 1, 1, 4, 4, 4],
"activity_date": [
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 21, 0, 0),
datetime(2019, 7, 21, 0, 0),
datetime(2019, 7, 21, 0, 0),
],
"activity_type": [
"open_session",
"scroll_down",
"end_session",
"open_session",
"send_message",
"end_session",
],
},
{
"day": [
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 21, 0, 0),
],
"active_users": [1, 1],
},
id="happy_path_1",
)
],
PARAMS_PROBLEMS_1141,
)
def test_problem_1141(input_data, expected_data):
table = pd.DataFrame(input_data)
Expand Down
33 changes: 33 additions & 0 deletions tests/test_problem_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,39 @@
]


PARAMS_PROBLEMS_1141 = [
pytest.param(
{
"user_id": [1, 1, 1, 2, 2, 2],
"session_id": [1, 1, 1, 4, 4, 4],
"activity_date": [
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 21, 0, 0),
datetime(2019, 7, 21, 0, 0),
datetime(2019, 7, 21, 0, 0),
],
"activity_type": [
"open_session",
"scroll_down",
"end_session",
"open_session",
"send_message",
"end_session",
],
},
{
"day": [
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 21, 0, 0),
],
"active_users": [1, 1],
},
id="happy_path_1",
)
]

PARAMS_PROBLEM_1164 = [
pytest.param(
{
Expand Down
33 changes: 1 addition & 32 deletions tests/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,38 +296,7 @@ def test_problem_1075(input_data_1, input_data_2, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"user_id": [1, 1, 1, 2, 2, 2],
"session_id": [1, 1, 1, 4, 4, 4],
"activity_date": [
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 21, 0, 0),
datetime(2019, 7, 21, 0, 0),
datetime(2019, 7, 21, 0, 0),
],
"activity_type": [
"open_session",
"scroll_down",
"end_session",
"open_session",
"send_message",
"end_session",
],
},
{
"day": [
datetime(2019, 7, 20, 0, 0),
datetime(2019, 7, 21, 0, 0),
],
"active_users": [1, 1],
},
id="happy_path_1",
)
],
PARAMS_PROBLEMS_1141,
)
def test_problem_1141(input_data, expected_data):
input_table = pa.Table.from_pydict(input_data)
Expand Down

0 comments on commit e4c8c5a

Please sign in to comment.