Skip to content

Commit ca64cd0

Browse files
authored
Adding unit-tests to doomsday algorithm
1 parent 8255072 commit ca64cd0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

other/doomsday.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323

2424

2525
def get_week_day(year: int, month: int, day: int) -> str:
26+
""" Returns the week-day name out of a given date.
27+
28+
>>> get_week_day(2020, 10, 24)
29+
Saturday
30+
>>> get_week_day(2017, 10, 24)
31+
Tuesday
32+
33+
"""
2634
# minimal input check:
2735
assert len(str(year)) > 2, 'Please supply year in YYYY format'
2836
assert 1 <= month <= 12, 'Invalid month value, please give a number between 1 to 12'
@@ -43,4 +51,4 @@ def get_week_day(year: int, month: int, day: int) -> str:
4351

4452
if __name__ == '__main__':
4553
# unit-test:
46-
assert get_week_day(2020, 10, 24) == 'Saturday'
54+
assert get_week_day(2020, 10, 24) == "Saturday"

0 commit comments

Comments
 (0)