(self)
| 12 | |
| 13 | class 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( |
nothing calls this directly
no test coverage detected