MCPcopy
hub / github.com/django/django / test_render_unique_app_labels

Method test_render_unique_app_labels

tests/migrations/test_state.py:580–599  ·  view source on GitHub ↗

The ProjectState render method doesn't raise an ImproperlyConfigured exception about unique labels if two dotted app names have the same last part.

(self)

Source from the content-addressed store, hash-verified

578 project_state.apps
579
580 def test_render_unique_app_labels(self):
581 """
582 The ProjectState render method doesn't raise an
583 ImproperlyConfigured exception about unique labels if two dotted app
584 names have the same last part.
585 """
586
587 class A(models.Model):
588 class Meta:
589 app_label = "django.contrib.auth"
590
591 class B(models.Model):
592 class Meta:
593 app_label = "vendor.auth"
594
595 # Make a ProjectState and render it
596 project_state = ProjectState()
597 project_state.add_model(ModelState.from_model(A))
598 project_state.add_model(ModelState.from_model(B))
599 self.assertEqual(len(project_state.apps.get_models()), 2)
600
601 def test_reload_related_model_on_non_relational_fields(self):
602 """

Callers

nothing calls this directly

Calls 4

add_modelMethod · 0.95
ProjectStateClass · 0.90
from_modelMethod · 0.80
get_modelsMethod · 0.45

Tested by

no test coverage detected