mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Refs #26709 -- Added type check for models.Index fields argument.
This commit is contained in:
parent
a71724cd04
commit
c969b17ad8
2 changed files with 6 additions and 0 deletions
|
|
@ -22,6 +22,10 @@ class IndexesTests(TestCase):
|
|||
self.assertEqual(index, same_index)
|
||||
self.assertNotEqual(index, another_index)
|
||||
|
||||
def test_index_fields_type(self):
|
||||
with self.assertRaisesMessage(ValueError, 'Index.fields must be a list.'):
|
||||
models.Index(fields='title')
|
||||
|
||||
def test_raises_error_without_field(self):
|
||||
msg = 'At least one field is required to define an index.'
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue