Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apurvabanka committed Oct 13, 2024
1 parent 5ad43b6 commit 200bcb5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
5 changes: 3 additions & 2 deletions tests/containers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def test_container_feature_append(self) -> None:
name="name"
)
feature = features._Feature(name="new_feature")
assert container.append(feature) is None
with pytest.raises(ValueError):
container.append(feature)
assert feature in container.features
with pytest.raises(ValueError, match="Cannot append self"):
container.append(container)

def test_document_container_get_style_url(self) -> None:
Expand Down
24 changes: 10 additions & 14 deletions tests/geometries/boundaries_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ def test_outer_boundary(self) -> None:
"</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs>"
)

def test_outer_boundry_geometry_error(self) -> None:
"""Test GeometryError."""
p = geo.Point(1, 2)
coords = ((1, 2), (2, 0), (0, 0), (1, 2))

with pytest.raises(GeometryError):
OuterBoundaryIs(
kml_geometry=LinearRing(kml_coordinates=Coordinates(coords=coords)),
geometry=p
)

def test_read_outer_boundary(self) -> None:
"""Test the from_string method."""
outer_boundary = OuterBoundaryIs.class_from_string(
Expand Down Expand Up @@ -86,17 +75,24 @@ def test_inner_boundary(self) -> None:
"</kml:coordinates></kml:LinearRing></kml:innerBoundaryIs>"
)

def test_inner_boundry_geometry_error(self) -> None:
"""Test GeometryError."""
def _test_boundary_geometry_error(self, boundary_class):
p = geo.Point(1, 2)
coords = ((1, 2), (2, 0), (0, 0), (1, 2))

with pytest.raises(GeometryError):
InnerBoundaryIs(
boundary_class(
kml_geometry=LinearRing(kml_coordinates=Coordinates(coords=coords)),
geometry=p
)

def test_outer_boundary_geometry_error(self):
"""Test that OuterBoundaryIs raises GeometryError with invalid geometry."""
self._test_boundary_geometry_error(OuterBoundaryIs)

def test_inner_boundary_geometry_error(self):
"""Test that InnerBoundaryIs raises GeometryError with invalid geometry."""
self._test_boundary_geometry_error(InnerBoundaryIs)

def test_read_inner_boundary_multiple_linestrings(self) -> None:
"""
Test the from_string method.
Expand Down
2 changes: 1 addition & 1 deletion tests/geometries/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_coordinates_subelement_exception(self) -> None:
setattr(obj,
'coordinates',
[(1.123456, 2.654321, 3.111111, 4.222222)]
)
)

element = Mock()

Expand Down

0 comments on commit 200bcb5

Please sign in to comment.