diff options
| author | Mads Jensen <mje@inducks.org> | 2018-03-28 15:03:56 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-29 13:58:55 -0400 |
| commit | c59aa9e6aa0b90bc8d4f8e9be0079c3c5b901879 (patch) | |
| tree | 710b1dc5cf35d49b290d204e7f80ffcd93f8f22a | |
| parent | fbb93581498070272dd67c6e0afbca13cb89d5f3 (diff) | |
Added test for combining Q objects with non-Q objects.
| -rw-r--r-- | tests/queries/test_q.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/queries/test_q.py b/tests/queries/test_q.py index 9e71553ef7..9adff07ef2 100644 --- a/tests/queries/test_q.py +++ b/tests/queries/test_q.py @@ -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() |
