Added tests for raising an error when passing non-boolean expression to When().

This commit is contained in:
Mariusz Felisiak 2019-08-29 09:29:46 +02:00 committed by GitHub
parent a44d80f88e
commit c7f656435c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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()