Skip to content

Commit

Permalink
CI/TST: fix tests for changed numpy error from creating ragged array (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Nov 24, 2022
1 parent 4604408 commit 108f180
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shapely/tests/test_strtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_pickle_persistence(tmp_path):
)
@pytest.mark.filterwarnings("ignore:Creating an ndarray from ragged nested sequences:")
def test_query_invalid_geometry(tree, geometry):
with pytest.raises(TypeError):
with pytest.raises((TypeError, ValueError)):
tree.query(geometry)


Expand Down
4 changes: 2 additions & 2 deletions tests/test_create_inconsistent_dimensionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def test_create_from_geojson(geojson):
# exact error depends on numpy version
with pytest.raises((ValueError, TypeError)) as exc:
wkt = shape(geojson).wkt
assert exc.match("Inconsistent coordinate dimensionality|Input operand 0 does not have enough dimensions|ufunc 'linestrings' not supported for the input types")
assert exc.match("Inconsistent coordinate dimensionality|Input operand 0 does not have enough dimensions|ufunc 'linestrings' not supported for the input types|setting an array element with a sequence. The requested array has an inhomogeneous shape")


@pytest.mark.filterwarnings("ignore:Creating an ndarray from ragged nested sequences:")
@pytest.mark.parametrize('constructor, args', direct_cases)
def test_create_directly(constructor, args):
with pytest.raises((ValueError, TypeError)) as exc:
geom = constructor(*args)
assert exc.match("Inconsistent coordinate dimensionality|Input operand 0 does not have enough dimensions|ufunc 'linestrings' not supported for the input types")
assert exc.match("Inconsistent coordinate dimensionality|Input operand 0 does not have enough dimensions|ufunc 'linestrings' not supported for the input types|setting an array element with a sequence. The requested array has an inhomogeneous shape")


@pytest.mark.parametrize('wkt_geom,expected', wkt_cases)
Expand Down

0 comments on commit 108f180

Please sign in to comment.