From 57c41a00dc79b41577dd6dfa528b55c5228d2aeb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 23:46:40 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pygeoif/factories.py | 2 +- tests/test_factories.py | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pygeoif/factories.py b/pygeoif/factories.py index 8377b309..4f7da1b8 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -86,7 +86,7 @@ def force_2d( geometry["coordinates"] = move_coordinates( # type: ignore [typeddict-unknown-key] geometry["coordinates"], # type: ignore [typeddict-item] - (0, 0), + (0, 0), ) return shape(geometry) diff --git a/tests/test_factories.py b/tests/test_factories.py index ef76119b..e3b5b475 100644 --- a/tests/test_factories.py +++ b/tests/test_factories.py @@ -77,7 +77,11 @@ def test_force_2d_multilinestring() -> None: # 3d multi line string to 2d multi line string mls = geometry.MultiLineString([[(1, 2, 3), (4, 5, 6)], [(7, 8, 9), (10, 11, 12)]]) mls2d = factories.force_2d(mls) - assert list(mls2d.geoms) == [geometry.LineString([(1, 2), (4, 5)]), geometry.LineString([(7, 8), (10, 11)])] + assert list(mls2d.geoms) == [ + geometry.LineString([(1, 2), (4, 5)]), + geometry.LineString([(7, 8), (10, 11)]), + ] + def test_force_2d_polygon() -> None: # 2d to 2d (no actual change) @@ -85,9 +89,7 @@ def test_force_2d_polygon() -> None: internal = [(0.5, 0.5), (0.5, 1.5), (1.5, 1.5), (1.5, 0.5), (0.5, 0.5)] p = geometry.Polygon(external, [internal]) p2d = factories.force_2d(p) - assert p2d.coords[0] == ( - ((0, 0), (0, 2), (2, 2), (2, 0), (0, 0)) - ) + assert p2d.coords[0] == (((0, 0), (0, 2), (2, 2), (2, 0), (0, 0))) assert p2d.coords[1] == ( ((0.5, 0.5), (0.5, 1.5), (1.5, 1.5), (1.5, 0.5), (0.5, 0.5)), ) @@ -96,13 +98,17 @@ def test_force_2d_polygon() -> None: # 3d to 2d external = [(0, 0, 1), (0, 2, 1), (2, 2, 1), (2, 0, 1), (0, 0, 1)] - internal = [(0.5, 0.5, 1), (0.5, 1.5, 1), (1.5, 1.5, 1), (1.5, 0.5, 1), (0.5, 0.5, 1)] + internal = [ + (0.5, 0.5, 1), + (0.5, 1.5, 1), + (1.5, 1.5, 1), + (1.5, 0.5, 1), + (0.5, 0.5, 1), + ] p = geometry.Polygon(external, [internal]) p2d = factories.force_2d(p) - assert p2d.coords[0] == ( - ((0, 0), (0, 2), (2, 2), (2, 0), (0, 0)) - ) + assert p2d.coords[0] == (((0, 0), (0, 2), (2, 2), (2, 0), (0, 0))) assert p2d.coords[1] == ( ((0.5, 0.5), (0.5, 1.5), (1.5, 1.5), (1.5, 0.5), (0.5, 0.5)), ) @@ -126,7 +132,9 @@ def test_force2d_collection() -> None: assert list(gc2d.geoms) == list(gc.geoms) # 3d to 2d - gc = geometry.GeometryCollection([geometry.Point(-1, 1, 0), geometry.Point(-2, 2, 0)]) + gc = geometry.GeometryCollection( + [geometry.Point(-1, 1, 0), geometry.Point(-2, 2, 0)], + ) gc2d = factories.force_2d(gc) assert list(gc2d.geoms) == [geometry.Point(-1, 1), geometry.Point(-2, 2)]