diff options
author | Hannes Ljungberg <hannes.ljungberg@gmail.com> | 2021-01-12 13:05:01 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-01-12 20:22:44 +0100 |
commit | 4c62cdaa1041d49d0b46f6cef5f4618f020fff29 (patch) | |
tree | 0f231904fd260334abc949fd1046c89cbf6f895d /tests/model_indexes | |
parent | c412d9af7e4121f6979758312c9426fa6893e9b7 (diff) | |
download | django-4c62cdaa1041d49d0b46f6cef5f4618f020fff29.tar.gz |
Refs #26709 -- Made Index raise ValueError on non-string fields.
Diffstat (limited to 'tests/model_indexes')
-rw-r--r-- | tests/model_indexes/tests.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/model_indexes/tests.py b/tests/model_indexes/tests.py index 93ac47130a..1fe283340e 100644 --- a/tests/model_indexes/tests.py +++ b/tests/model_indexes/tests.py @@ -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']) |