Skip to content

Commit

Permalink
testing: Added ISO date parsing test
Browse files Browse the repository at this point in the history
Added test to check the parse_iso_date function to improve
code coverage.
  • Loading branch information
chrisarridge committed Jul 9, 2024
1 parent 53ab836 commit 0125018
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_timeliness.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,19 @@ def test_short_month():
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
for index, s in enumerate(month_strings):
assert timeliness.short_month('01-{:02d}-2024'.format(index + 1)) == s

def test_parse_iso_date():
test_date_1 = timeliness.parse_iso_date("2024-01-01")
assert test_date_1.year==2024
assert test_date_1.month==1
assert test_date_1.day==1

test_date_2 = timeliness.parse_iso_date("2024-02-29")
assert test_date_2.year==2024
assert test_date_2.month==2
assert test_date_2.day==29

test_date_3 = timeliness.parse_iso_date("2024-04-01")
assert test_date_3.year==2024
assert test_date_3.month==4
assert test_date_3.day==1

0 comments on commit 0125018

Please sign in to comment.