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

Method test_basic

tests/db_functions/comparison/test_coalesce.py:14–20  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

12
13class CoalesceTests(TestCase):
14 def test_basic(self):
15 Author.objects.create(name="John Smith", alias="smithj")
16 Author.objects.create(name="Rhonda")
17 authors = Author.objects.annotate(display_name=Coalesce("alias", "name"))
18 self.assertQuerySetEqual(
19 authors.order_by("name"), ["smithj", "Rhonda"], lambda a: a.display_name
20 )
21
22 def test_gt_two_expressions(self):
23 with self.assertRaisesMessage(

Callers

nothing calls this directly

Calls 5

CoalesceClass · 0.90
annotateMethod · 0.80
assertQuerySetEqualMethod · 0.80
order_byMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected