Test the custom ``django_date_trunc method``, in particular against fields which clash with strings passed to it (e.g. 'year') (#12818).
(self)
| 47 | |
| 48 | class DateQuotingTest(TestCase): |
| 49 | def test_django_date_trunc(self): |
| 50 | """ |
| 51 | Test the custom ``django_date_trunc method``, in particular against |
| 52 | fields which clash with strings passed to it (e.g. 'year') (#12818). |
| 53 | """ |
| 54 | updated = datetime.datetime(2010, 2, 20) |
| 55 | SchoolClass.objects.create(year=2009, last_updated=updated) |
| 56 | years = SchoolClass.objects.dates("last_updated", "year") |
| 57 | self.assertEqual(list(years), [datetime.date(2010, 1, 1)]) |
| 58 | |
| 59 | def test_django_date_extract(self): |
| 60 | """ |