From: Christian Heller Date: Sun, 17 Mar 2024 01:03:33 +0000 (+0100) Subject: Fix and extend Day date testing. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/foo.html?a=commitdiff_plain;h=4907c8d031ece55f84123293e28648cdc8e9619e;p=plomtask Fix and extend Day date testing. --- diff --git a/tests/test_days.py b/tests/test_days.py index ba627e9..7805208 100644 --- a/tests/test_days.py +++ b/tests/test_days.py @@ -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."""