diff options
| author | Mike Edmunds <medmunds@gmail.com> | 2025-07-22 20:40:48 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-23 20:17:55 -0300 |
| commit | 55b0cc21310b76ce4018dd793ba50556eaf0af06 (patch) | |
| tree | b56d75363688b6ac34f7e9a773c793d79750104b /tests | |
| parent | 5527df91921b54b9fd1eb9aca3aabe91ec58a9c7 (diff) | |
Refs #36500 -- Shortened some long docstrings and comments.
Manually reformatted some long docstrings and comments that would be
damaged by the to-be-applied autofixer script, in cases where editorial
judgment seemed necessary for style or wording changes.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_scripts/tests.py | 2 | ||||
| -rw-r--r-- | tests/annotations/tests.py | 14 | ||||
| -rw-r--r-- | tests/delete/tests.py | 4 | ||||
| -rw-r--r-- | tests/forms_tests/tests/tests.py | 4 | ||||
| -rw-r--r-- | tests/gis_tests/distapp/tests.py | 24 | ||||
| -rw-r--r-- | tests/gis_tests/geo3d/tests.py | 9 | ||||
| -rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 6 | ||||
| -rw-r--r-- | tests/gis_tests/test_spatialrefsys.py | 6 | ||||
| -rw-r--r-- | tests/introspection/tests.py | 8 | ||||
| -rw-r--r-- | tests/lookup/tests.py | 2 | ||||
| -rw-r--r-- | tests/migrations/test_operations.py | 8 | ||||
| -rw-r--r-- | tests/model_forms/tests.py | 2 | ||||
| -rw-r--r-- | tests/model_formsets/tests.py | 2 | ||||
| -rw-r--r-- | tests/pagination/tests.py | 2 |
14 files changed, 55 insertions, 38 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index aad05220ed..a272fced74 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1558,7 +1558,7 @@ class ManageCheck(AdminScriptTestCase): args = ["check"] out, err = self.run_manage(args) expected_err = ( - "System check identified some issues:\n" # No "CommandError: " part + "System check identified some issues:\n" # No "CommandError: " "\n" "WARNINGS:\n" "?: A warning\n" diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py index eb077fcb57..4c0ec66665 100644 --- a/tests/annotations/tests.py +++ b/tests/annotations/tests.py @@ -1160,8 +1160,8 @@ class NonAggregateAnnotationTestCase(TestCase): crafted_alias = """injected_name" from "annotations_book"; --""" # RemovedInDjango70Warning: When the deprecation ends, replace with: # msg = ( - # "Column aliases cannot contain whitespace characters, quotation marks, " - # "semicolons, percent signs, or SQL comments." + # "Column aliases cannot contain whitespace characters, quotation " + # "marks, semicolons, percent signs, or SQL comments." # ) msg = ( "Column aliases cannot contain whitespace characters, quotation marks, " @@ -1182,7 +1182,7 @@ class NonAggregateAnnotationTestCase(TestCase): "ali/*as", "alias*/", "alias;", - # RemovedInDjango70Warning: When the deprecation ends, add this case. + # RemovedInDjango70Warning: When the deprecation ends, add this: # "alias%", # [] are used by MSSQL. "alias[", @@ -1190,8 +1190,8 @@ class NonAggregateAnnotationTestCase(TestCase): ] # RemovedInDjango70Warning: When the deprecation ends, replace with: # msg = ( - # "Column aliases cannot contain whitespace characters, quotation marks, " - # "semicolons, percent signs, or SQL comments." + # "Column aliases cannot contain whitespace characters, quotation " + # "marks, semicolons, percent signs, or SQL comments." # ) msg = ( "Column aliases cannot contain whitespace characters, quotation marks, " @@ -1496,8 +1496,8 @@ class AliasTests(TestCase): crafted_alias = """injected_name" from "annotations_book"; --""" # RemovedInDjango70Warning: When the deprecation ends, replace with: # msg = ( - # "Column aliases cannot contain whitespace characters, quotation marks, " - # "semicolons, percent signs, or SQL comments." + # "Column aliases cannot contain whitespace characters, quotation " + # "marks, semicolons, percent signs, or SQL comments." # ) msg = ( "Column aliases cannot contain whitespace characters, quotation marks, " diff --git a/tests/delete/tests.py b/tests/delete/tests.py index e24c222063..09c9a0a818 100644 --- a/tests/delete/tests.py +++ b/tests/delete/tests.py @@ -493,7 +493,7 @@ class DeletionTests(TestCase): # and there are no more cascades. # 1 query to find the users for the avatar. # 1 query to delete the user - # 1 query to null out user.avatar, because we can't defer the constraint + # 1 query to null out user.avatar, since we can't defer the constraint # 1 query to delete the avatar self.assertNumQueries(4, a.delete) self.assertFalse(User.objects.exists()) @@ -536,7 +536,7 @@ class DeletionTests(TestCase): # TEST_SIZE / batch_size (select related `T` instances) # + 1 (select related `U` instances) - # + TEST_SIZE / GET_ITERATOR_CHUNK_SIZE (delete `T` instances in batches) + # + TEST_SIZE / GET_ITERATOR_CHUNK_SIZE (delete `T` matches in batches) # + 1 (delete `s`) expected_num_queries = ceil(TEST_SIZE / batch_size) expected_num_queries += ceil(TEST_SIZE / GET_ITERATOR_CHUNK_SIZE) + 2 diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index 38735bfb78..086627c9e7 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -247,7 +247,7 @@ class ModelFormCallableModelDefault(TestCase): class FormsModelTestCase(TestCase): def test_unicode_filename(self): - # FileModel with Unicode filename and data ######################### + # FileModel with Unicode filename and data. file1 = SimpleUploadedFile( "我隻氣墊船裝滿晒鱔.txt", "मेरी मँडराने वाली नाव सर्पमीनों से भरी ह".encode() ) @@ -263,7 +263,7 @@ class FormsModelTestCase(TestCase): m.delete() def test_boundary_conditions(self): - # Boundary conditions on a PositiveIntegerField ######################### + # Boundary conditions on a PositiveIntegerField. class BoundaryForm(ModelForm): class Meta: model = BoundaryModel diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py index 2b51e999f7..f5879beeff 100644 --- a/tests/gis_tests/distapp/tests.py +++ b/tests/gis_tests/distapp/tests.py @@ -442,7 +442,10 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): # using the provided raw SQL statements. # SELECT ST_Distance( # point, - # ST_Transform(ST_GeomFromText('POINT(-96.876369 29.905320)', 4326), 32140) + # ST_Transform( + # ST_GeomFromText('POINT(-96.876369 29.905320)', 4326), + # 32140 + # ) # ) # FROM distapp_southtexascity; m_distances = [ @@ -458,7 +461,10 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): ] # SELECT ST_Distance( # point, - # ST_Transform(ST_GeomFromText('POINT(-96.876369 29.905320)', 4326), 2278) + # ST_Transform( + # ST_GeomFromText('POINT(-96.876369 29.905320)', 4326), + # 2278 + # ) # ) # FROM distapp_southtexascityft; ft_distances = [ @@ -502,7 +508,10 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): # Reference query: # SELECT ST_distance_sphere( # point, - # ST_GeomFromText('LINESTRING(150.9020 -34.4245,150.8700 -34.5789)', 4326) + # ST_GeomFromText( + # 'LINESTRING(150.9020 -34.4245,150.8700 -34.5789)', + # 4326 + # ) # ) # FROM distapp_australiacity ORDER BY name; distances = [ @@ -542,7 +551,8 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): # point, # ST_GeomFromText('POINT(151.231341 -33.952685)', 4326) # ) - # FROM distapp_australiacity WHERE (NOT (id = 11)); st_distance_sphere + # FROM distapp_australiacity + # WHERE (NOT (id = 11)); st_distance_sphere spheroid_distances = [ 60504.0628957201, 77023.9489850262, @@ -662,7 +672,8 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): z = SouthTexasZipcode.objects.get(name="77005") # Reference query: - # SELECT ST_Distance(ST_Transform("distapp_censuszipcode"."poly", 32140), + # SELECT ST_Distance( + # ST_Transform("distapp_censuszipcode"."poly", 32140), # ST_GeomFromText('<buffer_wkt>', 32140)) # FROM "distapp_censuszipcode"; dists_m = [3553.30384972258, 1243.18391525602, 2186.15439472242] @@ -706,7 +717,8 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): # Reference query (should use `length_spheroid`). # SELECT ST_length_spheroid( # ST_GeomFromText('<wkt>', 4326) - # 'SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]]' + # 'SPHEROID["WGS 84",6378137,298.257223563, + # AUTHORITY["EPSG","7030"]]' # ); len_m1 = 473504.769553813 len_m2 = 4617.668 diff --git a/tests/gis_tests/geo3d/tests.py b/tests/gis_tests/geo3d/tests.py index e51fb7507b..7b7e6fea5a 100644 --- a/tests/gis_tests/geo3d/tests.py +++ b/tests/gis_tests/geo3d/tests.py @@ -283,7 +283,8 @@ class Geo3DFunctionsTests(FuncTestMixin, Geo3DLoadingHelper, TestCase): name="Houston" ) # GeoJSON should be 3D - # `SELECT ST_AsGeoJSON(point, 6) FROM geo3d_city3d WHERE name='Houston';` + # `SELECT ST_AsGeoJSON(point, 6) FROM geo3d_city3d + # WHERE name='Houston';` ref_json_regex = re.compile( r'^{"type":"Point","coordinates":\[-95.363151,29.763374,18(\.0+)?\]}$' ) @@ -295,7 +296,8 @@ class Geo3DFunctionsTests(FuncTestMixin, Geo3DLoadingHelper, TestCase): """ self._load_polygon_data() # Reference query for values below: - # `SELECT ST_Perimeter3D(poly), ST_Perimeter2D(poly) FROM geo3d_polygon3d;` + # `SELECT ST_Perimeter3D(poly), ST_Perimeter2D(poly) + # FROM geo3d_polygon3d;` ref_perim_3d = 76859.2620451 ref_perim_2d = 76859.2577803 tol = 6 @@ -314,7 +316,8 @@ class Geo3DFunctionsTests(FuncTestMixin, Geo3DLoadingHelper, TestCase): """ # ST_Length_Spheroid Z-aware, and thus does not need to use # a separate function internally. - # `SELECT ST_Length_Spheroid(line, 'SPHEROID["GRS 1980",6378137,298.257222101]') + # `SELECT ST_Length_Spheroid( + # line, 'SPHEROID["GRS 1980",6378137,298.257222101]') # FROM geo3d_interstate[2d|3d];` self._load_interstate_data() tol = 3 diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index 989f6069cd..047d6948b1 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -207,7 +207,8 @@ class GISFunctionsTests(FuncTestMixin, TestCase): def test_assvg(self): with self.assertRaises(TypeError): City.objects.annotate(svg=functions.AsSVG("point", precision="foo")) - # SELECT AsSVG(geoapp_city.point, 0, 8) FROM geoapp_city WHERE name = 'Pueblo'; + # SELECT AsSVG(geoapp_city.point, 0, 8) FROM geoapp_city + # WHERE name = 'Pueblo'; svg1 = 'cx="-104.609252" cy="-38.255001"' # Even though relative, only one point so it's practically the same except for # the 'c' letter prefix on the x,y values. @@ -737,7 +738,8 @@ class GISFunctionsTests(FuncTestMixin, TestCase): ) ) - # SELECT AsText(ST_SnapToGrid("geoapp_country"."mpoly", 0.5, 0.17, 0.05, 0.23)) + # SELECT AsText( + # ST_SnapToGrid("geoapp_country"."mpoly", 0.5, 0.17, 0.05, 0.23)) # FROM "geoapp_country" # WHERE "geoapp_country"."name" = 'San Marino'; ref = fromstr( diff --git a/tests/gis_tests/test_spatialrefsys.py b/tests/gis_tests/test_spatialrefsys.py index b87dcf8b92..d936ac8c89 100644 --- a/tests/gis_tests/test_spatialrefsys.py +++ b/tests/gis_tests/test_spatialrefsys.py @@ -86,9 +86,9 @@ class SpatialRefSysTest(TestCase): srs = self.SpatialRefSys.objects.get(srid=sd["srid"]) self.assertEqual(sd["srid"], srs.srid) - # Some of the authority names are borked on Oracle, e.g., SRID=32140. - # also, Oracle Spatial seems to add extraneous info to fields, hence the - # the testing with the 'startswith' flag. + # Some of the authority names are borked on Oracle, e.g., + # SRID=32140. Also, Oracle Spatial seems to add extraneous info to + # fields, hence the testing with the 'startswith' flag. auth_name, oracle_flag = sd["auth_name"] # Compare case-insensitively because srs.auth_name is lowercase # ("epsg") on Spatialite. diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index 139667a078..dc17313cc4 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -319,10 +319,10 @@ class IntrospectionTests(TransactionTestCase): foreign_key=None, ): # Different backends have different values for same constraints: - # PRIMARY KEY UNIQUE CONSTRAINT UNIQUE INDEX - # MySQL pk=1 uniq=1 idx=1 pk=0 uniq=1 idx=1 pk=0 uniq=1 idx=1 - # PostgreSQL pk=1 uniq=1 idx=0 pk=0 uniq=1 idx=0 pk=0 uniq=1 idx=1 - # SQLite pk=1 uniq=0 idx=0 pk=0 uniq=1 idx=0 pk=0 uniq=1 idx=1 + # PRIMARY KEY UNIQUE CONSTRAINT UNIQUE INDEX + # MySQL pk=1 uniq=1 idx=1 pk=0 uniq=1 idx=1 pk=0 uniq=1 idx=1 + # Postgres pk=1 uniq=1 idx=0 pk=0 uniq=1 idx=0 pk=0 uniq=1 idx=1 + # SQLite pk=1 uniq=0 idx=0 pk=0 uniq=1 idx=0 pk=0 uniq=1 idx=1 if details["primary_key"]: details["unique"] = True if details["unique"]: diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py index 7e4d267f4c..e89316a270 100644 --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -331,7 +331,7 @@ class LookupTests(TestCase): Author.objects.values_list().in_bulk() def test_values(self): - # values() returns a list of dictionaries instead of object instances -- + # values() returns a list of dictionaries instead of object instances, # and you can specify which fields you want to retrieve. self.assertSequenceEqual( Article.objects.values("headline"), diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index 1a268a8d86..f86fe16fe0 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -30,7 +30,7 @@ class Mixin: class OperationTests(OperationTestBase): """ Tests running the operations and making sure they do what they say they do. - Each test looks at their state changing, and then their database operation - + Each test looks at their state changing, and then their database operation, both forwards and backwards. """ @@ -1539,7 +1539,7 @@ class OperationTests(OperationTestBase): "digits", models.CharField(max_length=10, default="42"), ), - # Manual quoting is fragile and could trip on quotes. Refs #xyz. + # Manual quoting is fragile and could trip on quotes. migrations.AddField( "Pony", "quotes", @@ -1584,7 +1584,7 @@ class OperationTests(OperationTestBase): "digits", models.TextField(default="42"), ), - # Manual quoting is fragile and could trip on quotes. Refs #xyz. + # Manual quoting is fragile and could trip on quotes. migrations.AddField( "Pony", "quotes", @@ -1629,7 +1629,7 @@ class OperationTests(OperationTestBase): "digits", models.BinaryField(default=b"42"), ), - # Manual quoting is fragile and could trip on quotes. Refs #xyz. + # Manual quoting is fragile and could trip on quotes. migrations.AddField( "Pony", "quotes", diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index e96a897f4a..e7bdd1ac89 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -3067,7 +3067,7 @@ class OtherModelFormTests(TestCase): '<label for="id_url">The URL:</label><input type="text" name="url" ' 'maxlength="40" required id="id_url"></div>', ) - # to_field_name should also work on ModelMultipleChoiceField ################## + # to_field_name should also work on ModelMultipleChoiceField. field = forms.ModelMultipleChoiceField( Inventory.objects.all(), to_field_name="barcode" diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py index b3b8cdbc69..748e5f5018 100644 --- a/tests/model_formsets/tests.py +++ b/tests/model_formsets/tests.py @@ -1160,7 +1160,7 @@ class ModelFormsetTest(TestCase): 'maxlength="100"></p>', ) - # Custom primary keys with ForeignKey, OneToOneField and AutoField ############ + # Custom primary keys with ForeignKey, OneToOneField and AutoField. place = Place.objects.create(pk=1, name="Giordanos", city="Chicago") diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py index 0fa2099f08..ce39c63288 100644 --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -208,7 +208,7 @@ class PaginationTests(SimpleTestCase): self.assertEqual(paginator.validate_number(1.0), 1) def test_no_content_allow_empty_first_page(self): - # With no content and allow_empty_first_page=True, 1 is a valid page number + # With no content and allow_empty_first_page=True, 1 is a valid page. paginator = Paginator([], 2) self.assertEqual(paginator.validate_number(1), 1) |
