Added test for combining Q objects with non-Q objects.
@@ -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()
