from unittest import TestCase
from datetime import datetime
from tests.utils import TestCaseWithDB, TestCaseWithServer
from unittest import TestCase
from datetime import datetime
from tests.utils import TestCaseWithDB, TestCaseWithServer
- def test_Day_saving_and_caching(self) -> None:
- """Test .save/.save_core."""
+ def test_saving_and_caching(self) -> None:
+ """Test storage of instances.
+
+ We don't use the parent class's method here because the checked class
+ has too different a handling of IDs.
+ """
kwargs = {'date': self.default_ids[0], 'comment': 'foo'}
self.check_saving_and_caching(**kwargs)
kwargs = {'date': self.default_ids[0], 'comment': 'foo'}
self.check_saving_and_caching(**kwargs)
- self.assertEqual(Day.all(self.db_conn, (date2, '2024-01-07'),
+ day7 = Day('2024-01-07')
+ self.assertEqual(Day.all(self.db_conn, (day5.date, day7.date),
self.check_storage([day1, day2, day3, day6])
# check 'today' is interpreted as today's date
today = Day(todays_date())
self.check_storage([day1, day2, day3, day6])
# check 'today' is interpreted as today's date
today = Day(todays_date())