Created
August 2, 2016 09:27
-
-
Save claudep/78351dd6bbd5a53a04afc7dcd2f985bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/queries/tests.py b/tests/queries/tests.py | |
index 48b5737..145adf5 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") | |
+ lunch_food = Eaten.objects.create(food=apple, meal="lunch") | |
+ lunch_no_food = Eaten.objects.create(meal="lunch") | |
+ list(Eaten.objects.filter(food__isnull=False)) | |
+ 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment