summaryrefslogtreecommitdiff
path: root/tests/null_queries
diff options
context:
space:
mode:
authorHasan <hasan.r67@gmail.com>2016-01-17 14:56:39 +0330
committerTim Graham <timograham@gmail.com>2016-01-29 12:32:18 -0500
commit3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (patch)
tree0d1074cc65a72096e44a4165611fddfc5b7ef7fb /tests/null_queries
parent575706331bec4bf58ce36a9540c4c61fca49025b (diff)
downloaddjango-3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5.tar.gz
Refs #26022 -- Used context manager version of assertRaises in tests.
Diffstat (limited to 'tests/null_queries')
-rw-r--r--tests/null_queries/tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/null_queries/tests.py b/tests/null_queries/tests.py
index 3ba307d397..8f58b9dee1 100644
--- a/tests/null_queries/tests.py
+++ b/tests/null_queries/tests.py
@@ -40,10 +40,12 @@ class NullQueriesTests(TestCase):
)
# Valid query, but fails because foo isn't a keyword
- self.assertRaises(FieldError, Choice.objects.filter, foo__exact=None)
+ with self.assertRaises(FieldError):
+ Choice.objects.filter(foo__exact=None)
# Can't use None on anything other than __exact and __iexact
- self.assertRaises(ValueError, Choice.objects.filter, id__gt=None)
+ with self.assertRaises(ValueError):
+ Choice.objects.filter(id__gt=None)
# Related managers use __exact=None implicitly if the object hasn't been saved.
p2 = Poll(question="How?")