-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_daily.py
37 lines (30 loc) · 1.05 KB
/
test_daily.py
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
from unittest import TestCase
from daily import Daily, IllegalDateException
class TestDaily(TestCase):
def test_validate_filename_valid(self):
Daily._validate_date("2021-06-01")
def test_validate_filename_whitespaces(self):
Daily._validate_date(" 2021-06-01 ")
def test_validate_filename_invalid(self):
try:
Daily._validate_date("2021/06/01")
self.fail("Expected validation to fail")
except IllegalDateException:
pass
def test_validate_filename_invalid_two_digit_year(self):
try:
Daily._validate_date("21-06-01")
except IllegalDateException:
pass
def test_validate_filename_empty(self):
try:
Daily._validate_date("")
self.fail("Expected validation to fail")
except IllegalDateException:
pass
def test_validate_filename_nil(self):
try:
Daily._validate_date(None)
self.fail("Expected validation to fail")
except IllegalDateException:
pass