MCPcopy
hub / github.com/django/django / test_basic

Method test_basic

tests/db_functions/comparison/test_least.py:15–22  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

13
14class LeastTests(TestCase):
15 def test_basic(self):
16 now = timezone.now()
17 before = now - timedelta(hours=1)
18 Article.objects.create(
19 title="Testing with Django", written=before, published=now
20 )
21 articles = Article.objects.annotate(first_updated=Least("written", "published"))
22 self.assertEqual(articles.first().first_updated, before)
23
24 @skipUnlessDBFeature("greatest_least_ignores_nulls")
25 def test_ignores_null(self):

Callers

nothing calls this directly

Calls 5

LeastClass · 0.90
annotateMethod · 0.80
firstMethod · 0.80
nowMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected