1
0
mirror of https://github.com/django/django.git synced 2025-02-28 19:44:35 +00:00

Added ModelState.from_model() test for abstract model with unnamed indexes.

This commit is contained in:
Mariusz Felisiak 2024-03-22 13:31:33 +01:00 committed by GitHub
parent 8dbfef4695
commit 1c11dba835
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1856,8 +1856,11 @@ class ModelStateTests(SimpleTestCase):
class Child2(Abstract):
pass
abstract_state = ModelState.from_model(Abstract)
child1_state = ModelState.from_model(Child1)
child2_state = ModelState.from_model(Child2)
index_names = [index.name for index in abstract_state.options["indexes"]]
self.assertEqual(index_names, ["migrations__name_ae16a4_idx"])
index_names = [index.name for index in child1_state.options["indexes"]]
self.assertEqual(index_names, ["migrations__name_b0afd7_idx"])
index_names = [index.name for index in child2_state.options["indexes"]]