From cc4c548163e7a1a01b428a14781190c4ccb596eb Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 30 Jul 2022 18:48:23 +0200 Subject: [PATCH] Refactor period's str day tests --- .../periods/tests/period/test_str.py | 9 ++++++++ tests/core/test_periods.py | 21 ------------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/openfisca_core/periods/tests/period/test_str.py b/openfisca_core/periods/tests/period/test_str.py index f96102547b..47ea3c390d 100644 --- a/openfisca_core/periods/tests/period/test_str.py +++ b/openfisca_core/periods/tests/period/test_str.py @@ -21,4 +21,13 @@ def test_str_with_years(date_unit, instant, size, expected): [DateUnit.MONTH, Instant((2022, 3, 1)), 3, "month:2022-03:3"], ]) def test_str_with_months(date_unit, instant, size, expected): + assert str(Period((date_unit, instant, size))) == expected + + +@pytest.mark.parametrize("date_unit, instant, size, expected", [ + [DateUnit.DAY, Instant((2022, 1, 1)), 1, "2022-01-01"], + [DateUnit.DAY, Instant((2022, 1, 1)), 3, "day:2022-01-01:3"], + [DateUnit.DAY, Instant((2022, 3, 1)), 3, "day:2022-03-01:3"], + ]) +def test_str_with_days(date_unit, instant, size, expected): assert str(Period((date_unit, instant, size))) == expected \ No newline at end of file diff --git a/tests/core/test_periods.py b/tests/core/test_periods.py index 4ab5a3f91f..92c8b49022 100644 --- a/tests/core/test_periods.py +++ b/tests/core/test_periods.py @@ -9,31 +9,10 @@ first_march = Instant((2014, 3, 1)) -''' -Test Period -> String -''' - - -# Months - - - -# Days - -def test_day(): - assert str(Period((DAY, first_jan, 1))) == '2014-01-01' - - -def test_several_days(): - assert str(Period((DAY, first_jan, 3))) == 'day:2014-01-01:3' - assert str(Period((DAY, first_march, 3))) == 'day:2014-03-01:3' - - ''' Test String -> Period ''' - # Years def test_parsing_year():