MCPcopy
hub / github.com/django/django / test_composite_pk_import

Method test_composite_pk_import

tests/migrations/test_writer.py:1263–1280  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1261 MigrationWriter.register_serializer(complex, TestModel1)
1262
1263 def test_composite_pk_import(self):
1264 migration = type(
1265 "Migration",
1266 (migrations.Migration,),
1267 {
1268 "operations": [
1269 migrations.AddField(
1270 "foo",
1271 "bar",
1272 models.CompositePrimaryKey("foo_id", "bar_id"),
1273 ),
1274 ],
1275 },
1276 )
1277 writer = MigrationWriter(migration)
1278 output = writer.as_string()
1279 self.assertEqual(output.count("import"), 1)
1280 self.assertIn("from django.db import migrations, models", output)
1281
1282 def test_run_before(self):
1283 for run_before, expected_run_before_str in [

Callers

nothing calls this directly

Calls 3

as_stringMethod · 0.95
MigrationWriterClass · 0.90
countMethod · 0.45

Tested by

no test coverage detected