MCPcopy
hub / github.com/django/django / test_custom_lookup_none_rhs

Method test_custom_lookup_none_rhs

tests/lookup/tests.py:1663–1673  ·  view source on GitHub ↗

Lookup.can_use_none_as_rhs=True allows None as a lookup value.

(self)

Source from the content-addressed store, hash-verified

1661 self.assertCountEqual(authors, result)
1662
1663 def test_custom_lookup_none_rhs(self):
1664 """Lookup.can_use_none_as_rhs=True allows None as a lookup value."""
1665 season = Season.objects.create(year=2012, nulled_text_field=None)
1666 query = Season.objects.get_queryset().query
1667 field = query.model._meta.get_field("nulled_text_field")
1668 self.assertIsInstance(
1669 query.build_lookup(["isnull_none_rhs"], field, None), IsNullWithNoneAsRHS
1670 )
1671 self.assertTrue(
1672 Season.objects.filter(pk=season.pk, nulled_text_field__isnull_none_rhs=True)
1673 )
1674
1675 def test_exact_exists(self):
1676 qs = Article.objects.filter(pk=OuterRef("pk"))

Callers

nothing calls this directly

Calls 5

build_lookupMethod · 0.80
createMethod · 0.45
get_querysetMethod · 0.45
get_fieldMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected