home · contact · privacy
Fix and extend Day date testing.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 17 Mar 2024 01:03:33 +0000 (02:03 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 17 Mar 2024 01:03:33 +0000 (02:03 +0100)
tests/test_days.py

index ba627e98cfbfb2c010510f828e965678ba8e783f..7805208e749a664a655b97103ab3705799e062b1 100644 (file)
@@ -1,5 +1,6 @@
 """Test days module."""
 from unittest import TestCase
+from datetime import datetime
 from plomtask.days import Day
 from plomtask.misc import HandledException
 
@@ -11,9 +12,15 @@ class DayTests(TestCase):
         """Test Day's date format.."""
         with self.assertRaises(HandledException):
             Day('foo')
+        with self.assertRaises(HandledException):
             Day(None)
+        with self.assertRaises(HandledException):
             Day(3)
+        with self.assertRaises(HandledException):
             Day('2024-02-30')
+        with self.assertRaises(HandledException):
+            Day('2024-02-01 23:00:00')
+        self.assertEqual(datetime(2024, 1, 1), Day('2024-01-01').datetime)
 
     def test_Day_weekday(self):
         """Test Day.weekday."""