diff options
| author | David Wobrock <david.wobrock@gmail.com> | 2022-01-04 06:24:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-04 06:24:03 +0100 |
| commit | 482ee63b6f320cd4a834cb46fc651877bd2f2e28 (patch) | |
| tree | cbc8b5a781f0075deb7aebe87189435e715372e4 /tests | |
| parent | 0ed2919814c80e31626dffdb6b80d0c20d43452f (diff) | |
Fixed #33402 -- Optimized multiple AlterFooTogether operations.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_autodetector.py | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py index d25b14cedb..bb37af24e3 100644 --- a/tests/migrations/test_autodetector.py +++ b/tests/migrations/test_autodetector.py @@ -1573,21 +1573,13 @@ class AutodetectorTests(TestCase): self.assertOperationTypes(changes, 'otherapp', 0, [ 'AlterUniqueTogether', 'AlterIndexTogether', - 'AlterUniqueTogether', - 'AlterIndexTogether', ]) self.assertOperationAttributes( - changes, 'otherapp', 0, 0, name='book', unique_together=set(), - ) - self.assertOperationAttributes( - changes, 'otherapp', 0, 1, name='book', index_together=set(), - ) - self.assertOperationAttributes( - changes, 'otherapp', 0, 2, name='book', + changes, 'otherapp', 0, 0, name='book', unique_together={('title', 'author')}, ) self.assertOperationAttributes( - changes, 'otherapp', 0, 3, name='book', + changes, 'otherapp', 0, 1, name='book', index_together={('title', 'author')}, ) @@ -1639,26 +1631,18 @@ class AutodetectorTests(TestCase): self.assertOperationTypes(changes, 'otherapp', 0, [ 'AlterUniqueTogether', 'AlterIndexTogether', - 'AlterUniqueTogether', - 'AlterIndexTogether', 'RemoveField', ]) self.assertOperationAttributes( - changes, 'otherapp', 0, 0, name='book', unique_together=set(), - ) - self.assertOperationAttributes( - changes, 'otherapp', 0, 1, name='book', index_together=set(), - ) - self.assertOperationAttributes( - changes, 'otherapp', 0, 2, name='book', + changes, 'otherapp', 0, 0, name='book', unique_together={('author', 'title')}, ) self.assertOperationAttributes( - changes, 'otherapp', 0, 3, name='book', + changes, 'otherapp', 0, 1, name='book', index_together={('author', 'title')}, ) self.assertOperationAttributes( - changes, 'otherapp', 0, 4, model_name='book', name='newfield', + changes, 'otherapp', 0, 2, model_name='book', name='newfield', ) def test_alter_field_and_foo_together(self): @@ -1744,21 +1728,13 @@ class AutodetectorTests(TestCase): 'RenameField', 'AlterUniqueTogether', 'AlterIndexTogether', - 'AlterUniqueTogether', - 'AlterIndexTogether', ]) self.assertOperationAttributes( - changes, 'otherapp', 0, 1, name='book', unique_together=set(), - ) - self.assertOperationAttributes( - changes, 'otherapp', 0, 2, name='book', index_together=set(), - ) - self.assertOperationAttributes( - changes, 'otherapp', 0, 3, name='book', + changes, 'otherapp', 0, 1, name='book', unique_together={('title', 'newfield2')}, ) self.assertOperationAttributes( - changes, 'otherapp', 0, 4, name='book', + changes, 'otherapp', 0, 2, name='book', index_together={('title', 'newfield2')}, ) |
