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
26 lines (22 loc) · 824 Bytes
/
Copy pathdateValidator_test.py
File metadata and controls
26 lines (22 loc) · 824 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
from codonPython import dateValidator
import numpy as np
import math
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)