MCPcopy
hub / github.com/django/django / test_django_date_trunc

Method test_django_date_trunc

tests/backends/tests.py:49–57  ·  view source on GitHub ↗

Test the custom ``django_date_trunc method``, in particular against fields which clash with strings passed to it (e.g. 'year') (#12818).

(self)

Source from the content-addressed store, hash-verified

47
48class 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 """

Callers

nothing calls this directly

Calls 2

datesMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected