Skip to content

Commit f71db9d

Browse files
committed
test: deduplicate pytest params for problem 1581
1 parent 50d9afb commit f71db9d

File tree

3 files changed

+25
-42
lines changed

3 files changed

+25
-42
lines changed

tests/test_pandas.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -835,27 +835,7 @@ def test_problem_1527(input_data, expected_data):
835835

836836
@pytest.mark.parametrize(
837837
"input_data_1, input_data_2, expected_data",
838-
[
839-
pytest.param(
840-
{
841-
"visit_id": [1, 2, 5, 5, 5, 4, 6, 7, 8],
842-
"customer_id": [23, 9, 54, 54, 54, 30, 96, 54, 54],
843-
},
844-
{
845-
"visit_id": [1, 2, 5],
846-
"transaction_id": [12, 13, 9],
847-
"amount": [910, 970, 200],
848-
},
849-
{"customer_id": [30, 96, 54], "count_no_trans": [1, 1, 2]},
850-
id="happy_path",
851-
),
852-
pytest.param(
853-
{"visit_id": [10, 11], "customer_id": [100, 101]},
854-
{"visit_id": [1, 2], "transaction_id": [12, 13], "amount": [910, 970]},
855-
{"customer_id": [100, 101], "count_no_trans": [1, 1]},
856-
id="no_matching_visit_id",
857-
),
858-
],
838+
PARAMS_PROBLEM_1581,
859839
)
860840
def test_problem_1581(input_data_1, input_data_2, expected_data):
861841
table_1 = pd.DataFrame(input_data_1)

tests/test_problem_params.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,29 @@
12921292
]
12931293

12941294

1295+
PARAMS_PROBLEM_1581 = [
1296+
pytest.param(
1297+
{
1298+
"visit_id": [1, 2, 5, 5, 5, 4, 6, 7, 8],
1299+
"customer_id": [23, 9, 54, 54, 54, 30, 96, 54, 54],
1300+
},
1301+
{
1302+
"visit_id": [1, 2, 5],
1303+
"transaction_id": [12, 13, 9],
1304+
"amount": [910, 970, 200],
1305+
},
1306+
{"customer_id": [30, 96, 54], "count_no_trans": [1, 1, 2]},
1307+
id="happy_path",
1308+
),
1309+
pytest.param(
1310+
{"visit_id": [10, 11], "customer_id": [100, 101]},
1311+
{"visit_id": [1, 2], "transaction_id": [12, 13], "amount": [910, 970]},
1312+
{"customer_id": [100, 101], "count_no_trans": [1, 1]},
1313+
id="no_matching_visit_id",
1314+
),
1315+
]
1316+
1317+
12951318
PARAMS_PROBLEM_1683 = [
12961319
pytest.param(
12971320
{"tweet_id": [1, 2], "content": ["Short", "This is a long tweet"]},

tests/test_pyarrow.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -730,27 +730,7 @@ def test_problem_1527(input_data, expected_data):
730730

731731
@pytest.mark.parametrize(
732732
"input_data_1, input_data_2, expected_data",
733-
[
734-
pytest.param(
735-
{
736-
"visit_id": [1, 2, 5, 5, 5, 4, 6, 7, 8],
737-
"customer_id": [23, 9, 54, 54, 54, 30, 96, 54, 54],
738-
},
739-
{
740-
"visit_id": [1, 2, 5],
741-
"transaction_id": [12, 13, 9],
742-
"amount": [910, 970, 200],
743-
},
744-
{"customer_id": [30, 96, 54], "count_no_trans": [1, 1, 2]},
745-
id="happy_path",
746-
),
747-
pytest.param(
748-
{"visit_id": [10, 11], "customer_id": [100, 101]},
749-
{"visit_id": [1, 2], "transaction_id": [12, 13], "amount": [910, 970]},
750-
{"customer_id": [100, 101], "count_no_trans": [1, 1]},
751-
id="no_matching_visit_id",
752-
),
753-
],
733+
PARAMS_PROBLEM_1581,
754734
)
755735
def test_problem_1581(input_data_1, input_data_2, expected_data):
756736
table_1 = pa.Table.from_pydict(input_data_1)

0 commit comments

Comments
 (0)