Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ex1 #173

Closed
wants to merge 7 commits into from
Closed

Ex1 #173

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ex1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def get_week_day (week: int) -> str | None:

if week < 1 or week > 7:
return None
days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

return days[week - 1]
12 changes: 12 additions & 0 deletions tests/test_ex1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from src.ex1 import get_week_day

def test_ex1() -> None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rinomina correttamente il nome delle funzione

assert get_week_day(0) == None
assert get_week_day(1) == "Monday"
assert get_week_day(2) == "Tuesday"
assert get_week_day(8) == None
assert get_week_day(4) == "Thursday"
assert get_week_day(7) == "Sunday"
assert get_week_day(5) == "Friday"
assert get_week_day(32) == None
assert get_week_day(3) == "Wednesday"
Loading