mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Added tests for raising an error when passing non-boolean expression to When().
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user