Skip to content

Commit 5733307

Browse files
committed
test: deduplicate pytest params for problem 1789
1 parent 9d990dc commit 5733307

File tree

3 files changed

+33
-60
lines changed

3 files changed

+33
-60
lines changed

tests/test_pandas.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,36 +1211,7 @@ def test_problem_1757(input_data, expected_data):
12111211

12121212
@pytest.mark.parametrize(
12131213
"input_data, expected_data",
1214-
[
1215-
pytest.param(
1216-
{"employee_id": [1], "department_id": [101], "primary_flag": ["Y"]},
1217-
{"employee_id": [1], "department_id": [101]},
1218-
id="single_employee_primary_Y",
1219-
),
1220-
pytest.param(
1221-
{
1222-
"employee_id": [1, 2, 2],
1223-
"department_id": [101, 102, 103],
1224-
"primary_flag": ["N", "Y", "N"],
1225-
},
1226-
{"employee_id": [1, 2], "department_id": [101, 102]},
1227-
id="multiple_employees_one_primary_Y",
1228-
),
1229-
pytest.param(
1230-
{"employee_id": [1], "department_id": [101], "primary_flag": ["N"]},
1231-
{"employee_id": [1], "department_id": [101]},
1232-
id="single_employee_no_primary_Y",
1233-
),
1234-
pytest.param(
1235-
{
1236-
"employee_id": [1, 1, 2, 2, 3, 3],
1237-
"department_id": [101, 102, 101, 102, 101, 102],
1238-
"primary_flag": ["Y", "N", "Y", "N", "Y", "N"],
1239-
},
1240-
{"employee_id": [1, 2, 3], "department_id": [101, 101, 101]},
1241-
id="all_employees_multiple_departments",
1242-
),
1243-
],
1214+
PARAMS_PROBLEM_1789,
12441215
)
12451216
def test_problem_1789(input_data, expected_data):
12461217
table = pd.DataFrame(input_data)

tests/test_problem_params.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,37 @@
12101210
),
12111211
]
12121212

1213+
PARAMS_PROBLEM_1789 = [
1214+
pytest.param(
1215+
{"employee_id": [1], "department_id": [101], "primary_flag": ["Y"]},
1216+
{"employee_id": [1], "department_id": [101]},
1217+
id="single_employee_primary_Y",
1218+
),
1219+
pytest.param(
1220+
{
1221+
"employee_id": [1, 2, 2],
1222+
"department_id": [101, 102, 103],
1223+
"primary_flag": ["N", "Y", "N"],
1224+
},
1225+
{"employee_id": [1, 2], "department_id": [101, 102]},
1226+
id="multiple_employees_one_primary_Y",
1227+
),
1228+
pytest.param(
1229+
{"employee_id": [1], "department_id": [101], "primary_flag": ["N"]},
1230+
{"employee_id": [1], "department_id": [101]},
1231+
id="single_employee_no_primary_Y",
1232+
),
1233+
pytest.param(
1234+
{
1235+
"employee_id": [1, 1, 2, 2, 3, 3],
1236+
"department_id": [101, 102, 101, 102, 101, 102],
1237+
"primary_flag": ["Y", "N", "Y", "N", "Y", "N"],
1238+
},
1239+
{"employee_id": [1, 2, 3], "department_id": [101, 101, 101]},
1240+
id="all_employees_multiple_departments",
1241+
),
1242+
]
1243+
12131244
PARAMS_PROBLEM_1907 = [
12141245
pytest.param(
12151246
{"account_id": [1, 2, 3], "income": [10000, 25000, 100000]},

tests/test_pyarrow.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,36 +1095,7 @@ def test_problem_1757(input_data, expected_data):
10951095

10961096
@pytest.mark.parametrize(
10971097
"input_data, expected_data",
1098-
[
1099-
pytest.param(
1100-
{"employee_id": [1], "department_id": [101], "primary_flag": ["Y"]},
1101-
{"employee_id": [1], "department_id": [101]},
1102-
id="single_employee_primary_Y",
1103-
),
1104-
pytest.param(
1105-
{
1106-
"employee_id": [1, 2, 2],
1107-
"department_id": [101, 102, 103],
1108-
"primary_flag": ["N", "Y", "N"],
1109-
},
1110-
{"employee_id": [1, 2], "department_id": [101, 102]},
1111-
id="multiple_employees_one_primary_Y",
1112-
),
1113-
pytest.param(
1114-
{"employee_id": [1], "department_id": [101], "primary_flag": ["N"]},
1115-
{"employee_id": [1], "department_id": [101]},
1116-
id="single_employee_no_primary_Y",
1117-
),
1118-
pytest.param(
1119-
{
1120-
"employee_id": [1, 1, 2, 2, 3, 3],
1121-
"department_id": [101, 102, 101, 102, 101, 102],
1122-
"primary_flag": ["Y", "N", "Y", "N", "Y", "N"],
1123-
},
1124-
{"employee_id": [1, 2, 3], "department_id": [101, 101, 101]},
1125-
id="all_employees_multiple_departments",
1126-
),
1127-
],
1098+
PARAMS_PROBLEM_1789,
11281099
)
11291100
def test_problem_1789(input_data, expected_data):
11301101
table = pa.Table.from_pydict(input_data)

0 commit comments

Comments
 (0)