forked from bcalou/tp-python-doomsday-rule
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-date.py
More file actions
49 lines (33 loc) · 1.38 KB
/
test-date.py
File metadata and controls
49 lines (33 loc) · 1.38 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from doomsday.date import is_valid_date
if not is_valid_date('2021-10-10'):
print('\033[91m❌ 2021-10-10 should be valid')
elif not is_valid_date('1996-02-29'):
print('\033[91m❌ 1996-02-29 should be valid')
elif not is_valid_date('2000-02-29'):
print('\033[91m❌ 2000-02-29 should be valid')
elif not is_valid_date('2148-01-31'):
print('\033[91m❌ 2148-01-31 should be valid')
elif not is_valid_date('2148-1-2'):
print('\033[91m❌ 2148-1-2 should be valid')
elif is_valid_date('2021-20-00'):
print('\033[91m❌ 2021-20-00 should not be valid')
elif is_valid_date('2021-20-02'):
print('\033[91m❌ 2021-20-02 should not be valid')
elif is_valid_date('1582-05-05'):
print('\033[91m❌ 1582-05-05 should not be valid')
elif is_valid_date('1900-02-29'):
print('\033[91m❌ 1900-02-29 should not be valid')
elif is_valid_date('2021-04-31'):
print('\033[91m❌ 2021-04-31 should not be valid')
elif is_valid_date('01-01-2020'):
print('\033[91m❌ 01-01-2020 should not be valid')
elif is_valid_date('01-01-'):
print('\033[91m❌ 01-01- should not be valid')
elif is_valid_date('-01-2020'):
print('\033[91m❌ -01-2020 should not be valid')
elif is_valid_date('10-01-2020-02'):
print('\033[91m❌ 10-01-2020-02 should not be valid')
elif is_valid_date('10-01'):
print('\033[91m❌ 10-01 should not be valid')
else:
print('\033[92m✓ OK')