Kaydet (Commit) c59aa9e6 authored tarafından Mads Jensen's avatar Mads Jensen Kaydeden (comit) Tim Graham

Added test for combining Q objects with non-Q objects.

üst fbb93581
...@@ -19,6 +19,14 @@ class QTests(SimpleTestCase): ...@@ -19,6 +19,14 @@ class QTests(SimpleTestCase):
def test_combine_or_both_empty(self): def test_combine_or_both_empty(self):
self.assertEqual(Q() | Q(), Q()) 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): def test_deconstruct(self):
q = Q(price__gt=F('discounted_price')) q = Q(price__gt=F('discounted_price'))
path, args, kwargs = q.deconstruct() path, args, kwargs = q.deconstruct()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment