Skip to content

Commit

Permalink
test: deduplicate pytest params for problem 1075
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek committed Jan 27, 2025
1 parent e4c8c5a commit 656924e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 44 deletions.
23 changes: 1 addition & 22 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,28 +275,7 @@ def test_problem_1070(input_data, expected_data):

@pytest.mark.parametrize(
"input_data_1, input_data_2, expected_data",
[
pytest.param(
{
"employee_id": [1, 2, 3],
"project_id": [101, 102, 103],
"experience_years": [5, 10, 15],
},
{"employee_id": [1, 2, 3], "department": ["HR", "IT", "Finance"]},
{"project_id": [101, 102, 103], "average_years": [5.0, 10.0, 15.0]},
id="happy_path",
),
pytest.param(
{
"employee_id": [1, 2, 3],
"project_id": [101, 101, 101],
"experience_years": [33, 34, 34],
},
{"employee_id": [1, 2, 3], "department": ["HR", "IT", "IT"]},
{"project_id": [101], "average_years": [33.67]},
id="happy_path_rounding_2",
),
],
PARAMS_PROBLEM_1075,
)
def test_problem_1075(input_data_1, input_data_2, expected_data):
table_1 = pd.DataFrame(input_data_1)
Expand Down
23 changes: 23 additions & 0 deletions tests/test_problem_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,29 @@
]


PARAMS_PROBLEM_1075 = [
pytest.param(
{
"employee_id": [1, 2, 3],
"project_id": [101, 102, 103],
"experience_years": [5, 10, 15],
},
{"employee_id": [1, 2, 3], "department": ["HR", "IT", "Finance"]},
{"project_id": [101, 102, 103], "average_years": [5.0, 10.0, 15.0]},
id="happy_path",
),
pytest.param(
{
"employee_id": [1, 2, 3],
"project_id": [101, 101, 101],
"experience_years": [33, 34, 34],
},
{"employee_id": [1, 2, 3], "department": ["HR", "IT", "IT"]},
{"project_id": [101], "average_years": [33.67]},
id="happy_path_rounding_2",
),
]

PARAMS_PROBLEMS_1141 = [
pytest.param(
{
Expand Down
23 changes: 1 addition & 22 deletions tests/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,28 +263,7 @@ def test_problem_1070(input_data, expected_data):

@pytest.mark.parametrize(
"input_data_1, input_data_2, expected_data",
[
pytest.param(
{
"employee_id": [1, 2, 3],
"project_id": [101, 102, 103],
"experience_years": [5, 10, 15],
},
{"employee_id": [1, 2, 3], "department": ["HR", "IT", "Finance"]},
{"project_id": [101, 102, 103], "average_years": [5.0, 10.0, 15.0]},
id="happy_path",
),
pytest.param(
{
"employee_id": [1, 2, 3],
"project_id": [101, 101, 101],
"experience_years": [33, 34, 34],
},
{"employee_id": [1, 2, 3], "department": ["HR", "IT", "IT"]},
{"project_id": [101], "average_years": [33.67]},
id="happy_path_rounding_2",
),
],
PARAMS_PROBLEM_1075,
)
def test_problem_1075(input_data_1, input_data_2, expected_data):
table_1 = pa.Table.from_pydict(input_data_1)
Expand Down

0 comments on commit 656924e

Please sign in to comment.