Skip to content

Commit

Permalink
test: deduplicate pytest params for problem 1527
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek committed Feb 3, 2025
1 parent 10d52a4 commit ca23288
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.
18 changes: 1 addition & 17 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,23 +541,7 @@ def test_problem_1517(input_data, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{"conditions": ["DIAB1", "DIAB2", "DIAB3"]},
{"conditions": ["DIAB1"]},
id="starts_with_DIAB1",
),
pytest.param(
{"conditions": ["X DIAB1", "Y DIAB2", "Z DIAB1X"]},
{"conditions": ["X DIAB1", "Z DIAB1X"]},
id="contains_DIAB1",
),
pytest.param(
{"conditions": ["X DIAB1", "Y +DIAB1", "Z DIAB1X"]},
{"conditions": ["X DIAB1", "Z DIAB1X"]},
id="contains_DIAB1_and_not_prefixed_strangely",
),
],
PARAMS_PROBLEM_1527,
)
def test_problem_1527(input_data, expected_data):
table = pd.DataFrame(input_data)
Expand Down
18 changes: 18 additions & 0 deletions tests/test_problem_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,24 @@
),
]

PARAMS_PROBLEM_1527 = [
pytest.param(
{"conditions": ["DIAB1", "DIAB2", "DIAB3"]},
{"conditions": ["DIAB1"]},
id="starts_with_DIAB1",
),
pytest.param(
{"conditions": ["X DIAB1", "Y DIAB2", "Z DIAB1X"]},
{"conditions": ["X DIAB1", "Z DIAB1X"]},
id="contains_DIAB1",
),
pytest.param(
{"conditions": ["X DIAB1", "Y +DIAB1", "Z DIAB1X"]},
{"conditions": ["X DIAB1", "Z DIAB1X"]},
id="contains_DIAB1_and_not_prefixed_strangely",
),
]


PARAMS_PROBLEM_1581 = [
pytest.param(
Expand Down
18 changes: 1 addition & 17 deletions tests/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,23 +475,7 @@ def test_problem_1517(input_data, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{"conditions": ["DIAB1", "DIAB2", "DIAB3"]},
{"conditions": ["DIAB1"]},
id="starts_with_DIAB1",
),
pytest.param(
{"conditions": ["X DIAB1", "Y DIAB2", "Z DIAB1X"]},
{"conditions": ["X DIAB1", "Z DIAB1X"]},
id="contains_DIAB1",
),
pytest.param(
{"conditions": ["X DIAB1", "Y +DIAB1", "Z DIAB1X"]},
{"conditions": ["X DIAB1", "Z DIAB1X"]},
id="contains_DIAB1_and_not_prefixed_strangely",
),
],
PARAMS_PROBLEM_1527,
)
def test_problem_1527(input_data, expected_data):
table = pa.Table.from_pydict(input_data)
Expand Down

0 comments on commit ca23288

Please sign in to comment.