4
4
5
5
def zeller (date_input : str ) -> str :
6
6
"""
7
- Zellers Congruence Algorithm
8
- Find the day of the week for nearly any Gregorian or Julian calendar date
7
+ | Zellers Congruence Algorithm
8
+ | Find the day of the week for nearly any Gregorian or Julian calendar date
9
9
10
10
>>> zeller('01-31-2010')
11
11
'Your date 01-31-2010, is a Sunday!'
12
12
13
- Validate out of range month
13
+ Validate out of range month:
14
+
14
15
>>> zeller('13-31-2010')
15
16
Traceback (most recent call last):
16
17
...
@@ -21,6 +22,7 @@ def zeller(date_input: str) -> str:
21
22
ValueError: invalid literal for int() with base 10: '.2'
22
23
23
24
Validate out of range date:
25
+
24
26
>>> zeller('01-33-2010')
25
27
Traceback (most recent call last):
26
28
...
@@ -31,30 +33,35 @@ def zeller(date_input: str) -> str:
31
33
ValueError: invalid literal for int() with base 10: '.4'
32
34
33
35
Validate second separator:
36
+
34
37
>>> zeller('01-31*2010')
35
38
Traceback (most recent call last):
36
39
...
37
40
ValueError: Date separator must be '-' or '/'
38
41
39
42
Validate first separator:
43
+
40
44
>>> zeller('01^31-2010')
41
45
Traceback (most recent call last):
42
46
...
43
47
ValueError: Date separator must be '-' or '/'
44
48
45
49
Validate out of range year:
50
+
46
51
>>> zeller('01-31-8999')
47
52
Traceback (most recent call last):
48
53
...
49
54
ValueError: Year out of range. There has to be some sort of limit...right?
50
55
51
56
Test null input:
57
+
52
58
>>> zeller()
53
59
Traceback (most recent call last):
54
60
...
55
61
TypeError: zeller() missing 1 required positional argument: 'date_input'
56
62
57
- Test length of date_input:
63
+ Test length of `date_input`:
64
+
58
65
>>> zeller('')
59
66
Traceback (most recent call last):
60
67
...
0 commit comments