summaryrefslogtreecommitdiff
path: root/tests/null_queries
diff options
context:
space:
mode:
authorDenis Moskalets <denya.msk@gmail.com>2013-12-03 13:24:45 +0400
committerTim Graham <timograham@gmail.com>2013-12-18 09:34:53 -0500
commitd4e578d0f64971483ded49f9cae460ea174b5138 (patch)
treefd15d03814a02079a9a7e260e4648e8e0f2b16cd /tests/null_queries
parent2fd7fc134cf0c0685ceac22fd858509aa43f819f (diff)
downloaddjango-d4e578d0f64971483ded49f9cae460ea174b5138.tar.gz
Fixed #21552 -- Allowed the use of None for the iexact lookup.
Thanks Anubhav Joshi for the documentation.
Diffstat (limited to 'tests/null_queries')
-rw-r--r--tests/null_queries/tests.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/null_queries/tests.py b/tests/null_queries/tests.py
index e442479cd7..f807ad88ce 100644
--- a/tests/null_queries/tests.py
+++ b/tests/null_queries/tests.py
@@ -12,7 +12,8 @@ class NullQueriesTests(TestCase):
"""
Regression test for the use of None as a query value.
- None is interpreted as an SQL NULL, but only in __exact queries.
+ None is interpreted as an SQL NULL, but only in __exact and __iexact
+ queries.
Set up some initial polls and choices
"""
p1 = Poll(question='Why?')
@@ -26,6 +27,9 @@ class NullQueriesTests(TestCase):
# but every 'id' field has a value).
self.assertQuerysetEqual(Choice.objects.filter(choice__exact=None), [])
+ # The same behavior for iexact query.
+ self.assertQuerysetEqual(Choice.objects.filter(choice__iexact=None), [])
+
# Excluding the previous result returns everything.
self.assertQuerysetEqual(
Choice.objects.exclude(choice=None).order_by('id'),
@@ -38,10 +42,10 @@ class NullQueriesTests(TestCase):
# Valid query, but fails because foo isn't a keyword
self.assertRaises(FieldError, Choice.objects.filter, foo__exact=None)
- # Can't use None on anything other than __exact
+ # Can't use None on anything other than __exact and __iexact
self.assertRaises(ValueError, Choice.objects.filter, id__gt=None)
- # Can't use None on anything other than __exact
+ # Can't use None on anything other than __exact and __iexact
self.assertRaises(ValueError, Choice.objects.filter, foo__gt=None)
# Related managers use __exact=None implicitly if the object hasn't been saved.