Skip to content

Commit

Permalink
test: deduplicate pytest params for problem 1517
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek committed Jan 22, 2025
1 parent a1c2661 commit 50d9afb
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 237 deletions.
80 changes: 1 addition & 79 deletions tests/test_datafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,85 +212,7 @@ def test_problem_1484(input_data, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"user_id": [1, 2, 3, 4, 5, 6, 7],
"name": [
"Winston",
"Jonathan",
"Annabelle",
"Sally",
"Marwan",
"David",
"Shapiro",
],
"mail": [
"[email protected]",
"jonathanisgreat",
"[email protected]",
"[email protected]",
"quarz#[email protected]",
"[email protected]",
"[email protected]",
],
},
{
"user_id": [1, 3, 4],
"name": [
"Winston",
"Annabelle",
"Sally",
],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path",
),
pytest.param(
{
"user_id": [360, 966, 901, 162, 181, 240, 221, 388, 211, 178],
"name": [
"Ezra",
"Daniel",
"Yehudah",
"Daniel",
"Aharon",
"Gavriel",
"Levi",
"Eliyahu",
"Michael",
"Aharon",
],
"mail": [
"Ezra4VZabfK",
"DanielEnEMjNoG6",
"Yehudah*[email protected]",
"[email protected]",
"AharonxuZA530S8Q",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"AharonnDFFSqcY",
],
},
{
"user_id": [162, 240, 221, 388],
"name": ["Daniel", "Gavriel", "Levi", "Eliyahu"],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path_2",
),
],
PARAMS_PROBLEM_1517,
)
def test_problem_1517(input_data, expected_data):
table = pa.Table.from_pydict(input_data)
Expand Down
80 changes: 1 addition & 79 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,85 +793,7 @@ def test_problem_1484(input_data, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"user_id": [1, 2, 3, 4, 5, 6, 7],
"name": [
"Winston",
"Jonathan",
"Annabelle",
"Sally",
"Marwan",
"David",
"Shapiro",
],
"mail": [
"[email protected]",
"jonathanisgreat",
"[email protected]",
"[email protected]",
"quarz#[email protected]",
"[email protected]",
"[email protected]",
],
},
{
"user_id": [1, 3, 4],
"name": [
"Winston",
"Annabelle",
"Sally",
],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path",
),
pytest.param(
{
"user_id": [360, 966, 901, 162, 181, 240, 221, 388, 211, 178],
"name": [
"Ezra",
"Daniel",
"Yehudah",
"Daniel",
"Aharon",
"Gavriel",
"Levi",
"Eliyahu",
"Michael",
"Aharon",
],
"mail": [
"Ezra4VZabfK",
"DanielEnEMjNoG6",
"Yehudah*[email protected]",
"[email protected]",
"AharonxuZA530S8Q",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"AharonnDFFSqcY",
],
},
{
"user_id": [162, 240, 221, 388],
"name": ["Daniel", "Gavriel", "Levi", "Eliyahu"],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path_2",
),
],
PARAMS_PROBLEM_1517,
)
def test_problem_1517(input_data, expected_data):
table = pd.DataFrame(input_data)
Expand Down
81 changes: 81 additions & 0 deletions tests/test_problem_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,87 @@
]


PARAMS_PROBLEM_1517 = [
pytest.param(
{
"user_id": [1, 2, 3, 4, 5, 6, 7],
"name": [
"Winston",
"Jonathan",
"Annabelle",
"Sally",
"Marwan",
"David",
"Shapiro",
],
"mail": [
"[email protected]",
"jonathanisgreat",
"[email protected]",
"[email protected]",
"quarz#[email protected]",
"[email protected]",
"[email protected]",
],
},
{
"user_id": [1, 3, 4],
"name": [
"Winston",
"Annabelle",
"Sally",
],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path",
),
pytest.param(
{
"user_id": [360, 966, 901, 162, 181, 240, 221, 388, 211, 178],
"name": [
"Ezra",
"Daniel",
"Yehudah",
"Daniel",
"Aharon",
"Gavriel",
"Levi",
"Eliyahu",
"Michael",
"Aharon",
],
"mail": [
"Ezra4VZabfK",
"DanielEnEMjNoG6",
"Yehudah*[email protected]",
"[email protected]",
"AharonxuZA530S8Q",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"AharonnDFFSqcY",
],
},
{
"user_id": [162, 240, 221, 388],
"name": ["Daniel", "Gavriel", "Levi", "Eliyahu"],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path_2",
),
]


PARAMS_PROBLEM_1683 = [
pytest.param(
{"tweet_id": [1, 2], "content": ["Short", "This is a long tweet"]},
Expand Down
80 changes: 1 addition & 79 deletions tests/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,85 +692,7 @@ def test_problem_1378(input_data_1, input_data_2, expected_data):

@pytest.mark.parametrize(
"input_data, expected_data",
[
pytest.param(
{
"user_id": [1, 2, 3, 4, 5, 6, 7],
"name": [
"Winston",
"Jonathan",
"Annabelle",
"Sally",
"Marwan",
"David",
"Shapiro",
],
"mail": [
"[email protected]",
"jonathanisgreat",
"[email protected]",
"[email protected]",
"quarz#[email protected]",
"[email protected]",
"[email protected]",
],
},
{
"user_id": [1, 3, 4],
"name": [
"Winston",
"Annabelle",
"Sally",
],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path",
),
pytest.param(
{
"user_id": [360, 966, 901, 162, 181, 240, 221, 388, 211, 178],
"name": [
"Ezra",
"Daniel",
"Yehudah",
"Daniel",
"Aharon",
"Gavriel",
"Levi",
"Eliyahu",
"Michael",
"Aharon",
],
"mail": [
"Ezra4VZabfK",
"DanielEnEMjNoG6",
"Yehudah*[email protected]",
"[email protected]",
"AharonxuZA530S8Q",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"AharonnDFFSqcY",
],
},
{
"user_id": [162, 240, 221, 388],
"name": ["Daniel", "Gavriel", "Levi", "Eliyahu"],
"mail": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
],
},
id="happy_path_2",
),
],
PARAMS_PROBLEM_1517,
)
def test_problem_1517(input_data, expected_data):
table = pa.Table.from_pydict(input_data)
Expand Down

0 comments on commit 50d9afb

Please sign in to comment.