Skip to content

Commit

Permalink
Consolidate argument order
Browse files Browse the repository at this point in the history
As per e2e14c3 this should avoid some
potentially mistaken copy/paste.
  • Loading branch information
marcelofern committed Jan 13, 2025
1 parent 34887c5 commit 27c39e5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/django_pg_migration_tools/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def test_when_deferred_set(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as queries:
operation.database_forwards(
self.app_label, editor, project_state, new_state
self.app_label, editor, from_state=project_state, to_state=new_state
)

with connection.cursor() as cursor:
Expand Down Expand Up @@ -1043,7 +1043,7 @@ def test_when_deferred_set(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as reverse_queries:
operation.database_backwards(
self.app_label, editor, new_state, project_state
self.app_label, editor, from_state=new_state, to_state=project_state
)

# 1. Check that the constraint is still there.
Expand Down Expand Up @@ -2041,7 +2041,7 @@ def test_requires_atomic_false(self):
with pytest.raises(NotSupportedError):
with connection.schema_editor(atomic=True) as editor:
operation.database_forwards(
self.app_label, editor, project_state, new_state
self.app_label, editor, from_state=project_state, to_state=new_state
)

@pytest.mark.django_db(transaction=True)
Expand All @@ -2060,7 +2060,7 @@ def test_when_not_allowed_to_migrate_by_the_router(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as queries:
operation.database_forwards(
self.app_label, editor, project_state, new_state
self.app_label, editor, from_state=project_state, to_state=new_state
)
# No queries have run, because the migration wasn't allowed to run by
# the router.
Expand All @@ -2070,7 +2070,7 @@ def test_when_not_allowed_to_migrate_by_the_router(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as queries:
operation.database_backwards(
self.app_label, editor, new_state, project_state
self.app_label, editor, from_state=new_state, to_state=project_state
)

# No queries have run, because the migration wasn't allowed to run by
Expand Down Expand Up @@ -2103,7 +2103,7 @@ def test_operation(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as queries:
operation.database_forwards(
self.app_label, editor, project_state, new_state
self.app_label, editor, from_state=project_state, to_state=new_state
)

assert len(queries) == 2
Expand All @@ -2123,7 +2123,7 @@ def test_operation(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as reverse_queries:
operation.database_backwards(
self.app_label, editor, new_state, project_state
self.app_label, editor, from_state=new_state, to_state=project_state
)

assert len(reverse_queries) == 9
Expand Down Expand Up @@ -2174,7 +2174,7 @@ def test_operation(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as second_reverse_queries:
operation.database_backwards(
self.app_label, editor, new_state, project_state
self.app_label, editor, from_state=new_state, to_state=project_state
)
assert len(second_reverse_queries) == 4
assert second_reverse_queries[0]["sql"] == dedent("""
Expand Down Expand Up @@ -2227,7 +2227,7 @@ def test_when_column_already_deleted(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as queries:
operation.database_forwards(
self.app_label, editor, project_state, new_state
self.app_label, editor, from_state=project_state, to_state=new_state
)

assert len(queries) == 1
Expand All @@ -2243,7 +2243,7 @@ def test_when_column_already_deleted(self):
with connection.schema_editor(atomic=False, collect_sql=False) as editor:
with utils.CaptureQueriesContext(connection) as reverse_queries:
operation.database_backwards(
self.app_label, editor, new_state, project_state
self.app_label, editor, from_state=new_state, to_state=project_state
)

assert len(reverse_queries) == 9
Expand Down Expand Up @@ -2308,7 +2308,7 @@ def test_when_only_collecting(self):
with connection.schema_editor(atomic=False, collect_sql=True) as editor:
with utils.CaptureQueriesContext(connection) as queries:
operation.database_forwards(
self.app_label, editor, project_state, new_state
self.app_label, editor, from_state=project_state, to_state=new_state
)

assert len(queries) == 0
Expand All @@ -2322,7 +2322,7 @@ def test_when_only_collecting(self):
with connection.schema_editor(atomic=False, collect_sql=True) as editor:
with utils.CaptureQueriesContext(connection) as reverse_queries:
operation.database_backwards(
self.app_label, editor, new_state, project_state
self.app_label, editor, from_state=new_state, to_state=project_state
)

assert len(reverse_queries) == 0
Expand Down

0 comments on commit 27c39e5

Please sign in to comment.