diff options
| author | Eddy Adegnandjou <adegnandjoueddy12@gmail.com> | 2025-11-12 15:06:58 +0100 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-04-02 11:24:26 -0400 |
| commit | 3fb37ef41103ad0624ed9e8c3f7b9190f4264ae2 (patch) | |
| tree | aa95916a1a5df4ca9d2f52d9debc7713fa9e4697 /tests | |
| parent | 253f552c5809fa096116b601bd842ca4f3504860 (diff) | |
Refs #20024 -- Tested __in lookups with None against composite pk fields.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/composite_pk/test_filter.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/composite_pk/test_filter.py b/tests/composite_pk/test_filter.py index c4b393d6ea..617d8370db 100644 --- a/tests/composite_pk/test_filter.py +++ b/tests/composite_pk/test_filter.py @@ -607,3 +607,19 @@ class CompositePKFilterTupleLookupFallbackTests(CompositePKFilterTests): ) self.enterContext(feature_patch_1) self.enterContext(feature_patch_2) + + +class CompositePKExcludeNoneTests(TestCase): + @classmethod + def setUpTestData(cls): + cls.tenant = Tenant.objects.create() + cls.user = User.objects.create( + tenant=cls.tenant, id=1, email="exclude@example.com" + ) + + def test_pk_in_with_partial_or_all_none(self): + qs = User.objects + self.assertQuerySetEqual(qs.filter(pk__in=[(1, None)]), []) + self.assertQuerySetEqual(qs.filter(pk__in=[(None, None)]), []) + self.assertQuerySetEqual(qs.exclude(pk__in=[(1, None)]), [self.user]) + self.assertQuerySetEqual(qs.exclude(pk__in=[(None, None)]), [self.user]) |
