forked from codonlibrary/codonPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdateValidator_test.py
More file actions
30 lines (26 loc) · 863 Bytes
/
Copy pathdateValidator_test.py
File metadata and controls
30 lines (26 loc) · 863 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
27
28
29
30
from codonPython import dateValidator
import pytest
@pytest.mark.parametrize(
"date_string, expected",
[
("01/01/1900", True), # Edge date
("29/02/1992", True), # Leap Year
("31/05/2020", True), # 31-day month
("29/02/2040", True), # Leap Year
("31/12/2049", True), # Edge date
],
)
def test_validDate_positives(date_string, expected):
assert expected == dateValidator.validDate(date_string)
@pytest.mark.parametrize(
"date_string, expected",
[
("31/12/1899", False), # Edge date
("29/02/1990", False), # Leap Year
("31/04/2020", False), # 31-day month
("29/02/2041", False), # Leap Year
("01/01/2050", False), # Edge date
],
)
def test_validDate_negatives(date_string, expected):
assert expected == dateValidator.validDate(date_string)