diff options
| author | django-bot <ops@djangoproject.com> | 2025-07-22 20:41:41 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-23 20:17:55 -0300 |
| commit | 69a93a88edb56ba47f624dac7a21aacc47ea474f (patch) | |
| tree | f57507a4435d032493cae40e06ecb254790b67b2 /tests/gis_tests/layermap/tests.py | |
| parent | 55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff) | |
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.
Diffstat (limited to 'tests/gis_tests/layermap/tests.py')
| -rw-r--r-- | tests/gis_tests/layermap/tests.py | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py index c5ed84d39c..c590defbd0 100644 --- a/tests/gis_tests/layermap/tests.py +++ b/tests/gis_tests/layermap/tests.py @@ -130,7 +130,8 @@ class LayerMapTest(TestCase): self.assertEqual(Decimal(str(feat["Length"])), istate.length) elif feat.fid == 1: # Everything but the first two decimal digits were truncated, - # because the Interstate model's `length` field has decimal_places=2. + # because the Interstate model's `length` field has + # decimal_places=2. self.assertAlmostEqual(feat.get("Length"), float(istate.length), 2) for p1, p2 in zip(feat.geom, istate.path): @@ -138,7 +139,9 @@ class LayerMapTest(TestCase): self.assertAlmostEqual(p1[1], p2[1], 6) def county_helper(self, county_feat=True): - "Helper function for ensuring the integrity of the mapped County models." + """ + Helper function for ensuring the integrity of the mapped County models. + """ for name, n, st in zip(NAMES, NUMS, STATES): # Should only be one record b/c of `unique` keyword. c = County.objects.get(name=name) @@ -157,10 +160,12 @@ class LayerMapTest(TestCase): """ # All the following should work. - # Telling LayerMapping that we want no transformations performed on the data. + # Telling LayerMapping that we want no transformations performed on the + # data. lm = LayerMapping(County, co_shp, co_mapping, transform=False) - # Specifying the source spatial reference system via the `source_srs` keyword. + # Specifying the source spatial reference system via the `source_srs` + # keyword. lm = LayerMapping(County, co_shp, co_mapping, source_srs=4269) lm = LayerMapping(County, co_shp, co_mapping, source_srs="NAD83") @@ -179,13 +184,14 @@ class LayerMapTest(TestCase): with self.assertRaises(e): LayerMapping(County, co_shp, co_mapping, transform=False, unique=arg) - # No source reference system defined in the shapefile, should raise an error. + # No source reference system defined in the shapefile, should raise an + # error. if connection.features.supports_transform: with self.assertRaises(LayerMapError): LayerMapping(County, co_shp, co_mapping) - # Passing in invalid ForeignKey mapping parameters -- must be a dictionary - # mapping for the model the ForeignKey points to. + # Passing in invalid ForeignKey mapping parameters -- must be a + # dictionary mapping for the model the ForeignKey points to. bad_fk_map1 = copy(co_mapping) bad_fk_map1["state"] = "name" bad_fk_map2 = copy(co_mapping) @@ -195,9 +201,9 @@ class LayerMapTest(TestCase): with self.assertRaises(LayerMapError): LayerMapping(County, co_shp, bad_fk_map2, transform=False) - # There exist no State models for the ForeignKey mapping to work -- should raise - # a MissingForeignKey exception (this error would be ignored if the `strict` - # keyword is not set). + # There exist no State models for the ForeignKey mapping to work -- + # should raise a MissingForeignKey exception (this error would be + # ignored if the `strict` keyword is not set). lm = LayerMapping(County, co_shp, co_mapping, transform=False, unique="name") with self.assertRaises(MissingForeignKey): lm.save(silent=True, strict=True) @@ -208,12 +214,13 @@ class LayerMapTest(TestCase): ) # If a mapping is specified as a collection, all OGR fields that - # are not collections will be converted into them. For example, - # a Point column would be converted to MultiPoint. Other things being done + # are not collections will be converted into them. For example, a Point + # column would be converted to MultiPoint. Other things being done # w/the keyword args: # `transform=False`: Specifies that no transform is to be done; this - # has the effect of ignoring the spatial reference check (because the - # county shapefile does not have implicit spatial reference info). + # has the effect of ignoring the spatial reference check (because + # the county shapefile does not have implicit spatial reference + # info). # # `unique='name'`: Creates models on the condition that they have # unique county names; geometries from each feature however will be @@ -223,8 +230,8 @@ class LayerMapTest(TestCase): lm = LayerMapping(County, co_shp, co_mapping, transform=False, unique="name") lm.save(silent=True, strict=True) - # A reference that doesn't use the unique keyword; a new database record will - # created for each polygon. + # A reference that doesn't use the unique keyword; a new database + # record will created for each polygon. lm = LayerMapping(CountyFeat, co_shp, cofeat_mapping, transform=False) lm.save(silent=True, strict=True) |
