MCPcopy
hub / github.com/django/django / test_custom_operation

Method test_custom_operation

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

Source from the content-addressed store, hash-verified

1076 writer.path
1077
1078 def test_custom_operation(self):
1079 migration = type(
1080 "Migration",
1081 (migrations.Migration,),
1082 {
1083 "operations": [
1084 custom_migration_operations.operations.TestOperation(),
1085 custom_migration_operations.operations.CreateModel(),
1086 migrations.CreateModel("MyModel", (), {}, (models.Model,)),
1087 custom_migration_operations.more_operations.TestOperation(),
1088 ],
1089 "dependencies": [],
1090 },
1091 )
1092 writer = MigrationWriter(migration)
1093 output = writer.as_string()
1094 result = self.safe_exec(output)
1095 self.assertIn("custom_migration_operations", result)
1096 self.assertNotEqual(
1097 result["custom_migration_operations"].operations.TestOperation,
1098 result["custom_migration_operations"].more_operations.TestOperation,
1099 )
1100
1101 def test_sorted_dependencies(self):
1102 migration = type(

Callers

nothing calls this directly

Calls 3

as_stringMethod · 0.95
safe_execMethod · 0.95
MigrationWriterClass · 0.90

Tested by

no test coverage detected