mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Fixed #29178 -- Allowed Index.fields to accept a tuple.
This commit is contained in:
parent
8411e4a8fe
commit
10c0fe528a
3 changed files with 14 additions and 7 deletions
|
|
@ -28,9 +28,12 @@ class IndexesTests(SimpleTestCase):
|
|||
self.assertNotEqual(index, another_index)
|
||||
|
||||
def test_index_fields_type(self):
|
||||
with self.assertRaisesMessage(ValueError, 'Index.fields must be a list.'):
|
||||
with self.assertRaisesMessage(ValueError, 'Index.fields must be a list or tuple.'):
|
||||
models.Index(fields='title')
|
||||
|
||||
def test_fields_tuple(self):
|
||||
self.assertEqual(models.Index(fields=('title',)).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