Skip to content

Commit

Permalink
Refactor period's str day tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Jul 31, 2022
1 parent b22ac9c commit cc4c548
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
9 changes: 9 additions & 0 deletions openfisca_core/periods/tests/period/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 0 additions & 21 deletions tests/core/test_periods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit cc4c548

Please sign in to comment.