MCPcopy
hub / github.com/django/django / test_dates_query

Method test_dates_query

tests/extra_regress/tests.py:175–190  ·  view source on GitHub ↗

When calling the dates() method on a queryset with extra selection columns, we can (and should) ignore those columns. They don't change the result and cause incorrect SQL to be produced otherwise.

(self)

Source from the content-addressed store, hash-verified

173 )
174
175 def test_dates_query(self):
176 """
177 When calling the dates() method on a queryset with extra selection
178 columns, we can (and should) ignore those columns. They don't change
179 the result and cause incorrect SQL to be produced otherwise.
180 """
181 RevisionableModel.objects.create(
182 title="First Revision", when=datetime.datetime(2008, 9, 28, 10, 30, 0)
183 )
184
185 self.assertSequenceEqual(
186 RevisionableModel.objects.extra(select={"the_answer": "id"}).datetimes(
187 "when", "month"
188 ),
189 [datetime.datetime(2008, 9, 1, 0, 0)],
190 )
191
192 def test_values_with_extra(self):
193 """

Callers

nothing calls this directly

Calls 3

datetimesMethod · 0.80
createMethod · 0.45
extraMethod · 0.45

Tested by

no test coverage detected