Skip to content

Commit

Permalink
TST: update expected results for GEOS 3.13.0dev (shapely#1935)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Nov 17, 2023
1 parent 9540b77 commit dba2704
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
26 changes: 13 additions & 13 deletions shapely/tests/geometry/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,28 @@ def test_format_polygon():
assert format(poly, "X") == poly.wkb_hex

# Use f-strings with extra characters and rounding precision
assert f"<{poly:.2f}>" == (
"<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
"-10.00 -0.00, -7.07 7.07, -0.00 10.00, 7.07 7.07, 10.00 0.00))>"
)
if geos_version < (3, 13, 0):
assert f"<{poly:.2f}>" == (
"<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
"-10.00 -0.00, -7.07 7.07, -0.00 10.00, 7.07 7.07, 10.00 0.00))>"
)
else:
assert f"<{poly:.2f}>" == (
"<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
"-10.00 0.00, -7.07 7.07, 0.00 10.00, 7.07 7.07, 10.00 0.00))>"
)

# 'g' format varies depending on GEOS version
if geos_version >= (3, 13, 0):
expected_2G = (
"POLYGON ((10 0, 7.07 -7.07, 6.12E-16 -10, -7.07 -7.07, "
"-10 -1.22E-15, -7.07 7.07, -1.84E-15 10, 7.07 7.07, 10 0))"
)
elif geos_version < (3, 10, 0):
expected_2G = (
if geos_version < (3, 10, 0):
assert f"{poly:.2G}" == (
"POLYGON ((10 0, 7.1 -7.1, 1.6E-14 -10, -7.1 -7.1, "
"-10 -3.2E-14, -7.1 7.1, -4.6E-14 10, 7.1 7.1, 10 0))"
)
else:
expected_2G = (
assert f"{poly:.2G}" == (
"POLYGON ((10 0, 7.07 -7.07, 0 -10, -7.07 -7.07, "
"-10 0, -7.07 7.07, 0 10, 7.07 7.07, 10 0))"
)
assert f"{poly:.2G}" == expected_2G

# check empty
empty = Polygon()
Expand Down
10 changes: 5 additions & 5 deletions shapely/tests/test_strtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from numpy.testing import assert_array_equal

import shapely
from shapely import box, geos_version, MultiPoint, Point, STRtree
from shapely import box, geos_version, LineString, MultiPoint, Point, STRtree
from shapely.errors import UnsupportedGEOSVersionError
from shapely.testing import assert_geometries_equal
from shapely.tests.common import (
Expand Down Expand Up @@ -912,12 +912,12 @@ def test_query_crosses_polygons(poly_tree, geometry, expected):
# box contains points but touches only those at edges
(box(3, 3, 6, 6), [3, 6]),
([box(3, 3, 6, 6)], [[0, 0], [3, 6]]),
# buffer completely contains point in tree
# polygon completely contains point in tree
(shapely.buffer(Point(3, 3), 1), []),
([shapely.buffer(Point(3, 3), 1)], [[], []]),
# buffer intersects 2 points but touches only one
(shapely.buffer(Point(0, 1), 1), [1]),
([shapely.buffer(Point(0, 1), 1)], [[0], [1]]),
# linestring intersects 2 points but touches only one
(LineString([(-1, -1), (1, 1)]), [1]),
([LineString([(-1, -1), (1, 1)])], [[0], [1]]),
# multipoints intersect but not valid relation
(MultiPoint([[5, 5], [7, 7]]), []),
([MultiPoint([[5, 5], [7, 7]])], [[], []]),
Expand Down

0 comments on commit dba2704

Please sign in to comment.