From 50d9afb576f5c2745e98a34b3159966b214d173a Mon Sep 17 00:00:00 2001 From: Tyler White <50381805+IndexSeek@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:31:37 +0000 Subject: [PATCH] test: deduplicate pytest params for problem 1517 --- tests/test_datafusion.py | 80 +---------------------------------- tests/test_pandas.py | 80 +---------------------------------- tests/test_problem_params.py | 81 ++++++++++++++++++++++++++++++++++++ tests/test_pyarrow.py | 80 +---------------------------------- 4 files changed, 84 insertions(+), 237 deletions(-) diff --git a/tests/test_datafusion.py b/tests/test_datafusion.py index 2724a13..f3e7dd0 100644 --- a/tests/test_datafusion.py +++ b/tests/test_datafusion.py @@ -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": [ - "winston@leetcode.com", - "jonathanisgreat", - "bella-@leetcode.com", - "sally.come@leetcode.com", - "quarz#2020@leetcode.com", - "david69@gmail.com", - ".shapo@leetcode.com", - ], - }, - { - "user_id": [1, 3, 4], - "name": [ - "Winston", - "Annabelle", - "Sally", - ], - "mail": [ - "winston@leetcode.com", - "bella-@leetcode.com", - "sally.come@leetcode.com", - ], - }, - 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*5m9@leetcode.com", - "Daniel07L@leetcode.com", - "AharonxuZA530S8Q", - "GavrielLVC@leetcode.com", - "Leviz6OzK@leetcode.com", - "Eliyahu--wzsgX@leetcode.com", - ".Michael@leetcode.com", - "AharonnDFFSqcY", - ], - }, - { - "user_id": [162, 240, 221, 388], - "name": ["Daniel", "Gavriel", "Levi", "Eliyahu"], - "mail": [ - "Daniel07L@leetcode.com", - "GavrielLVC@leetcode.com", - "Leviz6OzK@leetcode.com", - "Eliyahu--wzsgX@leetcode.com", - ], - }, - id="happy_path_2", - ), - ], + PARAMS_PROBLEM_1517, ) def test_problem_1517(input_data, expected_data): table = pa.Table.from_pydict(input_data) diff --git a/tests/test_pandas.py b/tests/test_pandas.py index 17682f8..bd00efb 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -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": [ - "winston@leetcode.com", - "jonathanisgreat", - "bella-@leetcode.com", - "sally.come@leetcode.com", - "quarz#2020@leetcode.com", - "david69@gmail.com", - ".shapo@leetcode.com", - ], - }, - { - "user_id": [1, 3, 4], - "name": [ - "Winston", - "Annabelle", - "Sally", - ], - "mail": [ - "winston@leetcode.com", - "bella-@leetcode.com", - "sally.come@leetcode.com", - ], - }, - 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*5m9@leetcode.com", - "Daniel07L@leetcode.com", - "AharonxuZA530S8Q", - "GavrielLVC@leetcode.com", - "Leviz6OzK@leetcode.com", - "Eliyahu--wzsgX@leetcode.com", - ".Michael@leetcode.com", - "AharonnDFFSqcY", - ], - }, - { - "user_id": [162, 240, 221, 388], - "name": ["Daniel", "Gavriel", "Levi", "Eliyahu"], - "mail": [ - "Daniel07L@leetcode.com", - "GavrielLVC@leetcode.com", - "Leviz6OzK@leetcode.com", - "Eliyahu--wzsgX@leetcode.com", - ], - }, - id="happy_path_2", - ), - ], + PARAMS_PROBLEM_1517, ) def test_problem_1517(input_data, expected_data): table = pd.DataFrame(input_data) diff --git a/tests/test_problem_params.py b/tests/test_problem_params.py index 737ca60..a1ab677 100644 --- a/tests/test_problem_params.py +++ b/tests/test_problem_params.py @@ -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": [ + "winston@leetcode.com", + "jonathanisgreat", + "bella-@leetcode.com", + "sally.come@leetcode.com", + "quarz#2020@leetcode.com", + "david69@gmail.com", + ".shapo@leetcode.com", + ], + }, + { + "user_id": [1, 3, 4], + "name": [ + "Winston", + "Annabelle", + "Sally", + ], + "mail": [ + "winston@leetcode.com", + "bella-@leetcode.com", + "sally.come@leetcode.com", + ], + }, + 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*5m9@leetcode.com", + "Daniel07L@leetcode.com", + "AharonxuZA530S8Q", + "GavrielLVC@leetcode.com", + "Leviz6OzK@leetcode.com", + "Eliyahu--wzsgX@leetcode.com", + ".Michael@leetcode.com", + "AharonnDFFSqcY", + ], + }, + { + "user_id": [162, 240, 221, 388], + "name": ["Daniel", "Gavriel", "Levi", "Eliyahu"], + "mail": [ + "Daniel07L@leetcode.com", + "GavrielLVC@leetcode.com", + "Leviz6OzK@leetcode.com", + "Eliyahu--wzsgX@leetcode.com", + ], + }, + id="happy_path_2", + ), +] + + PARAMS_PROBLEM_1683 = [ pytest.param( {"tweet_id": [1, 2], "content": ["Short", "This is a long tweet"]}, diff --git a/tests/test_pyarrow.py b/tests/test_pyarrow.py index b7409ec..28d8979 100644 --- a/tests/test_pyarrow.py +++ b/tests/test_pyarrow.py @@ -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": [ - "winston@leetcode.com", - "jonathanisgreat", - "bella-@leetcode.com", - "sally.come@leetcode.com", - "quarz#2020@leetcode.com", - "david69@gmail.com", - ".shapo@leetcode.com", - ], - }, - { - "user_id": [1, 3, 4], - "name": [ - "Winston", - "Annabelle", - "Sally", - ], - "mail": [ - "winston@leetcode.com", - "bella-@leetcode.com", - "sally.come@leetcode.com", - ], - }, - 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*5m9@leetcode.com", - "Daniel07L@leetcode.com", - "AharonxuZA530S8Q", - "GavrielLVC@leetcode.com", - "Leviz6OzK@leetcode.com", - "Eliyahu--wzsgX@leetcode.com", - ".Michael@leetcode.com", - "AharonnDFFSqcY", - ], - }, - { - "user_id": [162, 240, 221, 388], - "name": ["Daniel", "Gavriel", "Levi", "Eliyahu"], - "mail": [ - "Daniel07L@leetcode.com", - "GavrielLVC@leetcode.com", - "Leviz6OzK@leetcode.com", - "Eliyahu--wzsgX@leetcode.com", - ], - }, - id="happy_path_2", - ), - ], + PARAMS_PROBLEM_1517, ) def test_problem_1517(input_data, expected_data): table = pa.Table.from_pydict(input_data)