Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions shapely/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@ def test_to_wkt_none():
assert shapely.to_wkt(None) is None


def test_to_wkt_array_with_empty_z():
# See GH-2004
empty_wkt = ["POINT Z EMPTY", None, "POLYGON Z EMPTY"]
empty_geoms = shapely.from_wkt(empty_wkt)
if shapely.geos_version < (3, 9, 0):
empty_wkt = ["POINT EMPTY", None, "POLYGON EMPTY"]
assert list(shapely.to_wkt(empty_geoms)) == empty_wkt


def test_to_wkt_exceptions():
with pytest.raises(TypeError):
shapely.to_wkt(1)
Expand Down
3 changes: 2 additions & 1 deletion src/ufuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3386,8 +3386,9 @@ static void to_wkt_func(char** args, const npy_intp* dimensions, const npy_intp*
goto finish;
}
if (wkt != NULL) {
Py_XDECREF(*out);
*out = PyUnicode_FromString(wkt);
goto finish;
continue;
}

#else
Expand Down