From c7f656435cbf4feee3515ae67cfbe12d6bf791fb Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 29 Aug 2019 09:29:46 +0200 Subject: [PATCH] Added tests for raising an error when passing non-boolean expression to When(). --- tests/expressions_case/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py index 94731491e0..f1255cb8e9 100644 --- a/tests/expressions_case/tests.py +++ b/tests/expressions_case/tests.py @@ -1330,6 +1330,8 @@ class CaseWhenTests(SimpleTestCase): msg = '__init__() takes either a Q object or lookups as keyword arguments' with self.assertRaisesMessage(TypeError, msg): When(condition=object()) + with self.assertRaisesMessage(TypeError, msg): + When(condition=Value(1, output_field=models.IntegerField())) with self.assertRaisesMessage(TypeError, msg): When()