Added test for combining Q objects with non-Q objects.
This commit is contained in:
parent
fbb9358149
commit
c59aa9e6aa
|
@ -19,6 +19,14 @@ class QTests(SimpleTestCase):
|
|||
def test_combine_or_both_empty(self):
|
||||
self.assertEqual(Q() | Q(), Q())
|
||||
|
||||
def test_combine_not_q_object(self):
|
||||
obj = object()
|
||||
q = Q(x=1)
|
||||
with self.assertRaisesMessage(TypeError, str(obj)):
|
||||
q | obj
|
||||
with self.assertRaisesMessage(TypeError, str(obj)):
|
||||
q & obj
|
||||
|
||||
def test_deconstruct(self):
|
||||
q = Q(price__gt=F('discounted_price'))
|
||||
path, args, kwargs = q.deconstruct()
|
||||
|
|
Loading…
Reference in New Issue