Skip to content

Commit

Permalink
test: deduplicate pytest params for problem 1661
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek committed Feb 1, 2025
1 parent 4cf7c5d commit faeca9c
Show file tree
Hide file tree
Showing 3 changed files with 34 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 @@ -680,38 +680,7 @@ def test_problem_1633(input_data_1, input_data_2, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"machine_id": [0, 0, 0, 0],
"process_id": [0, 0, 1, 1],
"activity_type": ["start", "end", "start", "end"],
"timestamp": [0.712, 1.52, 3.14, 4.12],
},
{"machine_id": [0], "processing_time": [0.894]},
id="happy_path_single_machine",
),
pytest.param(
{
"machine_id": [0, 0, 1, 1, 2, 2],
"process_id": [0, 0, 1, 1, 2, 2],
"activity_type": ["start", "end", "start", "end", "start", "end"],
"timestamp": [0.5, 1.5, 0.7, 1.2, 0.9, 2.0],
},
{"machine_id": [0, 1, 2], "processing_time": [1.0, 0.5, 1.1]},
id="multiple_machines",
),
pytest.param(
{
"machine_id": [0, 0, 1],
"process_id": [0, 0, 1],
"activity_type": ["start", "end", "start"],
"timestamp": [0.5, 1.5, 0.7],
},
{"machine_id": [0, 1], "processing_time": [1.0, None]},
id="incomplete_process",
),
],
PARAMS_PROBLEM_1661,
)
def test_problem_1661(input_data, expected_data):
table = pd.DataFrame(input_data)
Expand Down
32 changes: 32 additions & 0 deletions tests/test_problem_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,38 @@
),
]

PARAMS_PROBLEM_1661 = [
pytest.param(
{
"machine_id": [0, 0, 0, 0],
"process_id": [0, 0, 1, 1],
"activity_type": ["start", "end", "start", "end"],
"timestamp": [0.712, 1.52, 3.14, 4.12],
},
{"machine_id": [0], "processing_time": [0.894]},
id="happy_path_single_machine",
),
pytest.param(
{
"machine_id": [0, 0, 1, 1, 2, 2],
"process_id": [0, 0, 1, 1, 2, 2],
"activity_type": ["start", "end", "start", "end", "start", "end"],
"timestamp": [0.5, 1.5, 0.7, 1.2, 0.9, 2.0],
},
{"machine_id": [0, 1, 2], "processing_time": [1.0, 0.5, 1.1]},
id="multiple_machines",
),
pytest.param(
{
"machine_id": [0, 0, 1],
"process_id": [0, 0, 1],
"activity_type": ["start", "end", "start"],
"timestamp": [0.5, 1.5, 0.7],
},
{"machine_id": [0, 1], "processing_time": [1.0, None]},
id="incomplete_process",
),
]

PARAMS_PROBLEM_1683 = [
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 @@ -610,38 +610,7 @@ def test_problem_1633(input_data_1, input_data_2, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"machine_id": [0, 0, 0, 0],
"process_id": [0, 0, 1, 1],
"activity_type": ["start", "end", "start", "end"],
"timestamp": [0.712, 1.52, 3.14, 4.12],
},
{"machine_id": [0], "processing_time": [0.894]},
id="happy_path_single_machine",
),
pytest.param(
{
"machine_id": [0, 0, 1, 1, 2, 2],
"process_id": [0, 0, 1, 1, 2, 2],
"activity_type": ["start", "end", "start", "end", "start", "end"],
"timestamp": [0.5, 1.5, 0.7, 1.2, 0.9, 2.0],
},
{"machine_id": [0, 1, 2], "processing_time": [1.0, 0.5, 1.1]},
id="multiple_machines",
),
pytest.param(
{
"machine_id": [0, 0, 1],
"process_id": [0, 0, 1],
"activity_type": ["start", "end", "start"],
"timestamp": [0.5, 1.5, 0.7],
},
{"machine_id": [0, 1], "processing_time": [1.0, None]},
id="incomplete_process",
),
],
PARAMS_PROBLEM_1661,
)
def test_problem_1661(input_data, expected_data):
input_table = pa.Table.from_pydict(input_data)
Expand Down

0 comments on commit faeca9c

Please sign in to comment.