forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouredev.py
More file actions
26 lines (20 loc) · 668 Bytes
/
Copy pathmouredev.py
File metadata and controls
26 lines (20 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import datetime
def friday_13(year: int, month: int) -> bool:
try:
return datetime.date(year, month, 13).weekday() == 4
except:
return False
def test_friday_13_true_date():
assert friday_13(2023, 1)
def test_friday_13_false_date():
assert not friday_13(2023, 3)
def test_friday_13_invalid_year():
assert not friday_13("2023", 1)
assert not friday_13("MoureDev", 1)
assert not friday_13(-2023, 1)
def test_friday_13_invalid_month():
assert not friday_13(2023, "1")
assert not friday_13(2023, "one")
assert not friday_13(2023, -1)
def test_friday_13_invalid_data():
assert not friday_13("Brais", "Moure")