Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Mar 22, 2024
1 parent 059cc6f commit 5556e26
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/hypothesis/test_geometrycollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def test_repr_eval(multi_poly: geometry.GeometryCollection) -> None:
)


@given(geometry_collections(srs=epsg4326))
def test_shape(multi_poly: geometry.GeometryCollection) -> None:
@given(geometry_collections(srs=epsg4326, has_z=False))
def test_shape_2d(multi_poly: geometry.GeometryCollection) -> None:
assert multi_poly == shape(multi_poly)


@given(geometry_collections(srs=epsg4326, has_z=True))
def test_shape_3d(multi_poly: geometry.GeometryCollection) -> None:
assert multi_poly == shape(multi_poly)
6 changes: 6 additions & 0 deletions tests/hypothesis/test_line.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test LineStrings with Hypothesis."""

import pytest
from hypothesis import given

from pygeoif import geometry
Expand All @@ -11,6 +12,11 @@
from pygeoif.hypothesis.strategies import line_strings


def test_max_points_lt_2() -> None:
with pytest.raises(ValueError, match="^max_points must be greater than 1$"):
line_strings(max_points=1).example()


@given(line_strings(srs=epsg4326))
def test_from_wkt_epsg_4326(line: geometry.LineString) -> None:
assert line == from_wkt(str(line))
Expand Down
6 changes: 6 additions & 0 deletions tests/hypothesis/test_linear_ring.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test LinearRings with Hypothesis."""

import pytest
from hypothesis import given

from pygeoif import geometry
Expand All @@ -9,6 +10,11 @@
from pygeoif.hypothesis.strategies import linear_rings


def test_max_points_lt_3() -> None:
with pytest.raises(ValueError, match="^max_points must be greater than 3$"):
linear_rings(max_points=3).example()


@given(linear_rings(srs=epsg4326))
def test_from_wkt_epsg_4326(line: geometry.LinearRing) -> None:
assert line == from_wkt(str(line))
Expand Down
6 changes: 6 additions & 0 deletions tests/hypothesis/test_polygon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test Polygons with Hypothesis."""

import pytest
from hypothesis import given

from pygeoif import geometry
Expand All @@ -10,6 +11,11 @@
from pygeoif.hypothesis.strategies import polygons


def test_max_points_lt_3() -> None:
with pytest.raises(ValueError, match="^max_points must be greater than 3$"):
polygons(max_points=3).example()


@given(polygons(srs=epsg4326))
def test_from_wkt_epsg_4326(poly: geometry.Polygon) -> None:
assert poly == from_wkt(str(poly))
Expand Down

0 comments on commit 5556e26

Please sign in to comment.