MCPcopy
hub / github.com/django/django / test_ticket_21150

Method test_ticket_21150

tests/aggregation_regress/tests.py:1969–1981  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1967
1968class JoinPromotionTests(TestCase):
1969 def test_ticket_21150(self):
1970 b = Bravo.objects.create()
1971 c = Charlie.objects.create(bravo=b)
1972 qs = Charlie.objects.select_related("alfa").annotate(Count("bravo__charlie"))
1973 self.assertSequenceEqual(qs, [c])
1974 self.assertIs(qs[0].alfa, None)
1975 a = Alfa.objects.create()
1976 c.alfa = a
1977 c.save()
1978 # Force re-evaluation
1979 qs = qs.all()
1980 self.assertSequenceEqual(qs, [c])
1981 self.assertEqual(qs[0].alfa, a)
1982
1983 def test_existing_join_not_promoted(self):
1984 # No promotion for existing joins

Callers

nothing calls this directly

Calls 6

CountClass · 0.90
annotateMethod · 0.80
select_relatedMethod · 0.80
createMethod · 0.45
saveMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected