Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into regr-equal-z
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Jul 22, 2023
2 parents d1745ff + bee5531 commit 7e82a3d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
if: ${{ matrix.msvc_arch }}

- name: Build wheels
uses: pypa/cibuildwheel@v2.14.0
uses: pypa/cibuildwheel@v2.14.1
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: cp36-* pp* *musllinux* cp310-manylinux_i686
Expand Down
6 changes: 4 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ Improvements:
to allow, skip, or error on nonfinite (NaN / Inf) coordinates. The default
behaviour (allow) is backwards compatible (#1594).

Version 2.0.2 (unreleased)
--------------------------
2.0.2 (unreleased)
------------------

Bug fixes:

- Fix regression in the (in)equality comparison (``geom1 == geom2``) using ``__eq__`` to
not ignore the z-coordinates (#1732).
- Fix ``MultiPolygon()`` constructor to accept polygons without holes (#1850).


2.0.1 (2023-01-30)
------------------
Expand Down
2 changes: 2 additions & 0 deletions docs/release/2.x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Bug fixes:

- Fix regression in the (in)equality comparison (``geom1 == geom2``) using ``__eq__`` to
not ignore the z-coordinates (#1732).
- Fix ``MultiPolygon()`` constructor to accept polygons without holes (#1850).


.. _version-2-0-1:

Expand Down
5 changes: 4 additions & 1 deletion shapely/geometry/multipolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def __new__(self, polygons=None):
ob = polygons[i]
if not isinstance(ob, polygon.Polygon):
shell = ob[0]
holes = ob[1]
if len(ob) > 1:
holes = ob[1]
else:
holes = None
p = polygon.Polygon(shell, holes)
else:
p = polygon.Polygon(ob)
Expand Down
16 changes: 15 additions & 1 deletion shapely/tests/geometry/test_multipolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

class TestMultiPolygon(MultiGeometryTestCase):
def test_multipolygon(self):

# From coordinate tuples
coords = [
(
Expand All @@ -30,6 +29,21 @@ def test_multipolygon(self):
]
]

# Or without holes
coords2 = [(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)),)]
geom = MultiPolygon(coords2)
assert isinstance(geom, MultiPolygon)
assert len(geom.geoms) == 1
assert dump_coords(geom) == [
[
(0.0, 0.0),
(0.0, 1.0),
(1.0, 1.0),
(1.0, 0.0),
(0.0, 0.0),
]
]

# Or from polygons
p = Polygon(
((0, 0), (0, 1), (1, 1), (1, 0)),
Expand Down

0 comments on commit 7e82a3d

Please sign in to comment.