home · contact · privacy
Add date validation for Days.
[plomtask] / tests / test_days.py
1 """Test days module."""
2 from unittest import TestCase
3 from plomtask.days import Day
4 from plomtask.misc import HandledException
5
6
7 class DayTests(TestCase):
8     """Tests for testing the days module."""
9
10     def test_Day_dates(self):
11         """Test Day's date format.."""
12         with self.assertRaises(HandledException):
13             Day('foo')
14             Day(None)
15             Day(3)
16             Day('2024-02-30')
17
18     def test_Day_weekday(self):
19         """Test Day.weekday."""
20         self.assertEqual(Day('2024-03-17').weekday, 'Sunday')