mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
This commit is contained in:
@@ -2080,8 +2080,9 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_rename_field_preserve_db_column_preserve_constraint(self):
|
||||
"""
|
||||
Renaming a field that already had a db_column attribute and a constraint
|
||||
generates two no-op operations: RenameField and AlterConstraint.
|
||||
Renaming a field that already had a db_column attribute and a
|
||||
constraint generates two no-op operations: RenameField and
|
||||
AlterConstraint.
|
||||
"""
|
||||
before = [
|
||||
ModelState(
|
||||
@@ -2566,7 +2567,8 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
def test_circular_fk_dependency(self):
|
||||
"""
|
||||
Having a circular ForeignKey dependency automatically
|
||||
resolves the situation into 2 migrations on one side and 1 on the other.
|
||||
resolves the situation into 2 migrations on one side and 1 on the
|
||||
other.
|
||||
"""
|
||||
changes = self.get_changes(
|
||||
[], [self.author_with_book, self.book, self.publisher_with_book]
|
||||
@@ -2665,7 +2667,8 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_alter_db_table_no_changes(self):
|
||||
"""
|
||||
Alter_db_table doesn't generate a migration if no changes have been made.
|
||||
Alter_db_table doesn't generate a migration if no changes have been
|
||||
made.
|
||||
"""
|
||||
changes = self.get_changes(
|
||||
[self.author_with_db_table_options], [self.author_with_db_table_options]
|
||||
@@ -2675,8 +2678,8 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_keep_db_table_with_model_change(self):
|
||||
"""
|
||||
Tests when model changes but db_table stays as-is, autodetector must not
|
||||
create more than one operation.
|
||||
Tests when model changes but db_table stays as-is, autodetector must
|
||||
not create more than one operation.
|
||||
"""
|
||||
changes = self.get_changes(
|
||||
[self.author_with_db_table_options],
|
||||
@@ -4089,16 +4092,16 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_deconstructible_list(self):
|
||||
"""Nested deconstruction descends into lists."""
|
||||
# When lists contain items that deconstruct to identical values, those lists
|
||||
# should be considered equal for the purpose of detecting state changes
|
||||
# (even if the original items are unequal).
|
||||
# When lists contain items that deconstruct to identical values, those
|
||||
# lists should be considered equal for the purpose of detecting state
|
||||
# changes (even if the original items are unequal).
|
||||
changes = self.get_changes(
|
||||
[self.author_name_deconstructible_list_1],
|
||||
[self.author_name_deconstructible_list_2],
|
||||
)
|
||||
self.assertEqual(changes, {})
|
||||
# Legitimate differences within the deconstructed lists should be reported
|
||||
# as a change
|
||||
# Legitimate differences within the deconstructed lists should be
|
||||
# reported as a change
|
||||
changes = self.get_changes(
|
||||
[self.author_name_deconstructible_list_1],
|
||||
[self.author_name_deconstructible_list_3],
|
||||
@@ -4107,16 +4110,16 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_deconstructible_tuple(self):
|
||||
"""Nested deconstruction descends into tuples."""
|
||||
# When tuples contain items that deconstruct to identical values, those tuples
|
||||
# should be considered equal for the purpose of detecting state changes
|
||||
# (even if the original items are unequal).
|
||||
# When tuples contain items that deconstruct to identical values, those
|
||||
# tuples should be considered equal for the purpose of detecting state
|
||||
# changes (even if the original items are unequal).
|
||||
changes = self.get_changes(
|
||||
[self.author_name_deconstructible_tuple_1],
|
||||
[self.author_name_deconstructible_tuple_2],
|
||||
)
|
||||
self.assertEqual(changes, {})
|
||||
# Legitimate differences within the deconstructed tuples should be reported
|
||||
# as a change
|
||||
# Legitimate differences within the deconstructed tuples should be
|
||||
# reported as a change
|
||||
changes = self.get_changes(
|
||||
[self.author_name_deconstructible_tuple_1],
|
||||
[self.author_name_deconstructible_tuple_3],
|
||||
@@ -4125,16 +4128,16 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_deconstructible_dict(self):
|
||||
"""Nested deconstruction descends into dict values."""
|
||||
# When dicts contain items whose values deconstruct to identical values,
|
||||
# those dicts should be considered equal for the purpose of detecting
|
||||
# state changes (even if the original values are unequal).
|
||||
# When dicts contain items whose values deconstruct to identical
|
||||
# values, those dicts should be considered equal for the purpose of
|
||||
# detecting state changes (even if the original values are unequal).
|
||||
changes = self.get_changes(
|
||||
[self.author_name_deconstructible_dict_1],
|
||||
[self.author_name_deconstructible_dict_2],
|
||||
)
|
||||
self.assertEqual(changes, {})
|
||||
# Legitimate differences within the deconstructed dicts should be reported
|
||||
# as a change
|
||||
# Legitimate differences within the deconstructed dicts should be
|
||||
# reported as a change
|
||||
changes = self.get_changes(
|
||||
[self.author_name_deconstructible_dict_1],
|
||||
[self.author_name_deconstructible_dict_3],
|
||||
@@ -4146,16 +4149,17 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
Nested deconstruction is applied recursively to the args/kwargs of
|
||||
deconstructed objects.
|
||||
"""
|
||||
# If the items within a deconstructed object's args/kwargs have the same
|
||||
# deconstructed values - whether or not the items themselves are different
|
||||
# instances - then the object as a whole is regarded as unchanged.
|
||||
# If the items within a deconstructed object's args/kwargs have the
|
||||
# same deconstructed values - whether or not the items themselves are
|
||||
# different instances - then the object as a whole is regarded as
|
||||
# unchanged.
|
||||
changes = self.get_changes(
|
||||
[self.author_name_nested_deconstructible_1],
|
||||
[self.author_name_nested_deconstructible_2],
|
||||
)
|
||||
self.assertEqual(changes, {})
|
||||
# Differences that exist solely within the args list of a deconstructed object
|
||||
# should be reported as changes
|
||||
# Differences that exist solely within the args list of a deconstructed
|
||||
# object should be reported as changes
|
||||
changes = self.get_changes(
|
||||
[self.author_name_nested_deconstructible_1],
|
||||
[self.author_name_nested_deconstructible_changed_arg],
|
||||
@@ -4167,8 +4171,8 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
[self.author_name_nested_deconstructible_extra_arg],
|
||||
)
|
||||
self.assertEqual(len(changes), 1)
|
||||
# Differences that exist solely within the kwargs dict of a deconstructed object
|
||||
# should be reported as changes
|
||||
# Differences that exist solely within the kwargs dict of a
|
||||
# deconstructed object should be reported as changes
|
||||
changes = self.get_changes(
|
||||
[self.author_name_nested_deconstructible_1],
|
||||
[self.author_name_nested_deconstructible_changed_kwarg],
|
||||
@@ -4183,8 +4187,8 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_deconstruct_type(self):
|
||||
"""
|
||||
#22951 -- Uninstantiated classes with deconstruct are correctly returned
|
||||
by deep_deconstruct during serialization.
|
||||
#22951 -- Uninstantiated classes with deconstruct are correctly
|
||||
returned by deep_deconstruct during serialization.
|
||||
"""
|
||||
author = ModelState(
|
||||
"testapp",
|
||||
@@ -4243,7 +4247,9 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
side_effect=AssertionError("Should not have prompted for not null addition"),
|
||||
)
|
||||
def test_add_many_to_many(self, mocked_ask_method):
|
||||
"""#22435 - Adding a ManyToManyField should not prompt for a default."""
|
||||
"""
|
||||
#22435 - Adding a ManyToManyField should not prompt for a default.
|
||||
"""
|
||||
changes = self.get_changes(
|
||||
[self.author_empty, self.publisher], [self.author_with_m2m, self.publisher]
|
||||
)
|
||||
@@ -4362,9 +4368,9 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_many_to_many_removed_before_through_model_2(self):
|
||||
"""
|
||||
Removing a model that contains a ManyToManyField and the "through" model
|
||||
in the same change must remove the field before the model to maintain
|
||||
consistency.
|
||||
Removing a model that contains a ManyToManyField and the "through"
|
||||
model in the same change must remove the field before the model to
|
||||
maintain consistency.
|
||||
"""
|
||||
changes = self.get_changes(
|
||||
[
|
||||
@@ -4459,8 +4465,9 @@ class AutodetectorTests(BaseAutodetectorTests):
|
||||
|
||||
def test_non_circular_foreignkey_dependency_removal(self):
|
||||
"""
|
||||
If two models with a ForeignKey from one to the other are removed at the
|
||||
same time, the autodetector should remove them in the correct order.
|
||||
If two models with a ForeignKey from one to the other are removed at
|
||||
the same time, the autodetector should remove them in the correct
|
||||
order.
|
||||
"""
|
||||
changes = self.get_changes(
|
||||
[self.author_with_publisher, self.publisher_with_author], []
|
||||
|
||||
Reference in New Issue
Block a user