Support partial function inspection in data migrations
This commit is contained in:
1 parent
97a1f5c6c9
commit
2d15ea84f9
4 files changed
+50
-5
No files matched your search
@@ -104,6 +104,15 @@ class DataMigrationDetectionTestCase(unittest.TestCase):
|
||||
self.assertEqual(0, self.linter.nb_erroneous)
|
||||
self.assertFalse(self.linter.has_errors)
|
||||
|
||||
def test_partial_function(self):
|
||||
reverse_migration = self.linter.migration_loader.disk_migrations[
|
||||
("app_data_migrations", "0004_partial_function")
|
||||
]
|
||||
self.linter.lint_migration(reverse_migration)
|
||||
|
||||
self.assertEqual(1, self.linter.nb_warnings)
|
||||
self.assertFalse(self.linter.has_errors)
|
||||
|
||||
|
||||
class DataMigrationModelImportTestCase(unittest.TestCase):
|
||||
def test_missing_get_model_import(self):
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Generated by Django 2.2 on 2020-01-27 17:47
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def backward_op(c, david, test):
|
||||
pass
|
||||
|
||||
|
||||
def forward_op(const, arg1, arg2):
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("app_data_migrations", "0003_incorrect_arguments")]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
functools.partial(forward_op, "constant"),
|
||||
functools.partial(backward_op, "constant"),
|
||||
)
|
||||
]
|
||||
Reference in new issue
Block a user