mirror of
https://github.com/django/django.git
synced 2025-07-28 23:54:02 +00:00
Refs #26709 -- Made Index raise ValueError on non-string fields.
This commit is contained in:
parent
c412d9af7e
commit
4c62cdaa10
2 changed files with 7 additions and 0 deletions
|
@ -55,6 +55,11 @@ class SimpleIndexesTests(SimpleTestCase):
|
|||
with self.assertRaisesMessage(ValueError, 'Index.fields must be a list or tuple.'):
|
||||
models.Index(fields='title')
|
||||
|
||||
def test_index_fields_strings(self):
|
||||
msg = 'Index.fields must contain only strings with field names.'
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
models.Index(fields=[models.F('title')])
|
||||
|
||||
def test_fields_tuple(self):
|
||||
self.assertEqual(models.Index(fields=('title',)).fields, ['title'])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue