MCPcopy
hub / github.com/django/django / test_nested_outerref_lhs

Method test_nested_outerref_lhs

tests/lookup/tests.py:1682–1694  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1680 self.assertCountEqual(seasons, Season.objects.all())
1681
1682 def test_nested_outerref_lhs(self):
1683 tag = Tag.objects.create(name=self.au1.alias)
1684 tag.articles.add(self.a1)
1685 qs = Tag.objects.annotate(
1686 has_author_alias_match=Exists(
1687 Article.objects.annotate(
1688 author_exists=Exists(
1689 Author.objects.filter(alias=OuterRef(OuterRef("name")))
1690 ),
1691 ).filter(author_exists=True)
1692 ),
1693 )
1694 self.assertEqual(qs.get(has_author_alias_match=True), tag)
1695
1696 def test_exact_query_rhs_with_selected_columns(self):
1697 newest_author = Author.objects.create(name="Author 2")

Callers

nothing calls this directly

Calls 7

ExistsClass · 0.90
OuterRefClass · 0.90
annotateMethod · 0.80
createMethod · 0.45
addMethod · 0.45
filterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected