Skip to content

Commit 6ed1195

Browse files
committed
test: deduplicate pytest params for problem 1164
1 parent f71db9d commit 6ed1195

File tree

3 files changed

+54
-100
lines changed

3 files changed

+54
-100
lines changed

tests/test_pandas.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -396,56 +396,7 @@ def test_problem_1148(input_data, expected_data):
396396

397397
@pytest.mark.parametrize(
398398
"input_data, expected_data",
399-
[
400-
pytest.param(
401-
{
402-
"product_id": [1, 1, 2],
403-
"change_date": [
404-
datetime(2019, 8, 15),
405-
datetime(2019, 8, 16),
406-
datetime(2019, 8, 17),
407-
],
408-
"new_price": [100, 110, 120],
409-
},
410-
{"product_id": [1, 2], "price": [110, 10]},
411-
id="happy-path",
412-
),
413-
pytest.param(
414-
{
415-
"product_id": [1, 2],
416-
"change_date": [
417-
datetime(2019, 8, 17),
418-
datetime(2019, 8, 18),
419-
],
420-
"new_price": [100, 110],
421-
},
422-
{"product_id": [1, 2], "price": [10, 10]},
423-
id="no-products-before-cutoff",
424-
),
425-
pytest.param(
426-
{
427-
"product_id": [1],
428-
"change_date": [
429-
datetime(2019, 8, 18),
430-
],
431-
"new_price": [20],
432-
},
433-
{"product_id": [1], "price": [10]},
434-
id="single-product-after-cutoff",
435-
),
436-
pytest.param(
437-
{
438-
"product_id": [1, 2],
439-
"new_price": [100, 100],
440-
"change_date": [
441-
datetime(2019, 8, 1),
442-
datetime(2019, 8, 2),
443-
],
444-
},
445-
{"product_id": [1, 2], "price": [100, 100]},
446-
id="all-products-before-cutoff",
447-
),
448-
],
399+
PARAMS_PROBLEM_1164,
449400
)
450401
def test_problem_1164(input_data, expected_data):
451402
table = pd.DataFrame(input_data)

tests/test_problem_params.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,58 @@
838838
),
839839
]
840840

841+
842+
PARAMS_PROBLEM_1164 = [
843+
pytest.param(
844+
{
845+
"product_id": [1, 1, 2],
846+
"change_date": [
847+
datetime(2019, 8, 15),
848+
datetime(2019, 8, 16),
849+
datetime(2019, 8, 17),
850+
],
851+
"new_price": [100, 110, 120],
852+
},
853+
{"product_id": [1, 2], "price": [110, 10]},
854+
id="happy-path",
855+
),
856+
pytest.param(
857+
{
858+
"product_id": [1, 2],
859+
"change_date": [
860+
datetime(2019, 8, 17),
861+
datetime(2019, 8, 18),
862+
],
863+
"new_price": [100, 110],
864+
},
865+
{"product_id": [1, 2], "price": [10, 10]},
866+
id="no-products-before-cutoff",
867+
),
868+
pytest.param(
869+
{
870+
"product_id": [1],
871+
"change_date": [
872+
datetime(2019, 8, 18),
873+
],
874+
"new_price": [20],
875+
},
876+
{"product_id": [1], "price": [10]},
877+
id="single-product-after-cutoff",
878+
),
879+
pytest.param(
880+
{
881+
"product_id": [1, 2],
882+
"new_price": [100, 100],
883+
"change_date": [
884+
datetime(2019, 8, 1),
885+
datetime(2019, 8, 2),
886+
],
887+
},
888+
{"product_id": [1, 2], "price": [100, 100]},
889+
id="all-products-before-cutoff",
890+
),
891+
]
892+
841893
PARAMS_PROBLEM_1204 = [
842894
pytest.param(
843895
{

tests/test_pyarrow.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -378,56 +378,7 @@ def test_problem_1148(input_data, expected_data):
378378

379379
@pytest.mark.parametrize(
380380
"input_data, expected_data",
381-
[
382-
pytest.param(
383-
{
384-
"product_id": [1, 1, 2],
385-
"change_date": [
386-
datetime(2019, 8, 15),
387-
datetime(2019, 8, 16),
388-
datetime(2019, 8, 17),
389-
],
390-
"new_price": [100, 110, 120],
391-
},
392-
{"product_id": [1, 2], "price": [110, 10]},
393-
id="happy-path",
394-
),
395-
pytest.param(
396-
{
397-
"product_id": [1, 2],
398-
"change_date": [
399-
datetime(2019, 8, 17),
400-
datetime(2019, 8, 18),
401-
],
402-
"new_price": [100, 110],
403-
},
404-
{"product_id": [1, 2], "price": [10, 10]},
405-
id="no-products-before-cutoff",
406-
),
407-
pytest.param(
408-
{
409-
"product_id": [1],
410-
"change_date": [
411-
datetime(2019, 8, 18),
412-
],
413-
"new_price": [20],
414-
},
415-
{"product_id": [1], "price": [10]},
416-
id="single-product-after-cutoff",
417-
),
418-
pytest.param(
419-
{
420-
"product_id": [1, 2],
421-
"new_price": [100, 100],
422-
"change_date": [
423-
datetime(2019, 8, 1),
424-
datetime(2019, 8, 2),
425-
],
426-
},
427-
{"product_id": [1, 2], "price": [100, 100]},
428-
id="all-products-before-cutoff",
429-
),
430-
],
381+
PARAMS_PROBLEM_1164,
431382
)
432383
def test_problem_1164(input_data, expected_data):
433384
input_table = pa.Table.from_pydict(input_data)

0 commit comments

Comments
 (0)