summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 48b57376f9..a3a810ce5e 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2483,6 +2483,19 @@ class ToFieldTests(TestCase):
[node1]
)
+ def test_isnull_query(self):
+ apple = Food.objects.create(name="apple")
+ Eaten.objects.create(food=apple, meal="lunch")
+ Eaten.objects.create(meal="lunch")
+ self.assertQuerysetEqual(
+ Eaten.objects.filter(food__isnull=False),
+ ['<Eaten: apple at lunch>']
+ )
+ self.assertQuerysetEqual(
+ Eaten.objects.filter(food__isnull=True),
+ ['<Eaten: None at lunch>']
+ )
+
class ConditionalTests(BaseQuerysetTest):
"""Tests whose execution depend on different environment conditions like