MCPcopy
hub / github.com/django/django / test_create

Method test_create

tests/migrations/test_state.py:33–219  ·  view source on GitHub ↗

Tests making a ProjectState from an Apps

(self)

Source from the content-addressed store, hash-verified

31 """
32
33 def test_create(self):
34 """
35 Tests making a ProjectState from an Apps
36 """
37
38 new_apps = Apps(["migrations"])
39
40 class Author(models.Model):
41 name = models.CharField(max_length=255)
42 bio = models.TextField()
43 age = models.IntegerField(blank=True, null=True)
44
45 class Meta:
46 app_label = "migrations"
47 apps = new_apps
48 unique_together = ["name", "bio"]
49
50 class AuthorProxy(Author):
51 class Meta:
52 app_label = "migrations"
53 apps = new_apps
54 proxy = True
55 ordering = ["name"]
56
57 class SubAuthor(Author):
58 width = models.FloatField(null=True)
59
60 class Meta:
61 app_label = "migrations"
62 apps = new_apps
63
64 class Book(models.Model):
65 title = models.CharField(max_length=1000)
66 author = models.ForeignKey(Author, models.CASCADE)
67 contributors = models.ManyToManyField(Author)
68
69 class Meta:
70 app_label = "migrations"
71 apps = new_apps
72 verbose_name = "tome"
73 db_table = "test_tome"
74 indexes = [models.Index(fields=["title"])]
75
76 class Food(models.Model):
77 food_mgr = FoodManager("a", "b")
78 food_qs = FoodQuerySet.as_manager()
79 food_no_mgr = NoMigrationFoodManager("x", "y")
80
81 class Meta:
82 app_label = "migrations"
83 apps = new_apps
84
85 class FoodNoManagers(models.Model):
86 class Meta:
87 app_label = "migrations"
88 apps = new_apps
89
90 class FoodNoDefaultManager(models.Model):

Callers

nothing calls this directly

Calls 4

set_name_with_modelMethod · 0.95
AppsClass · 0.90
FoodManagerClass · 0.85
from_appsMethod · 0.80

Tested by

no test coverage detected