Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 2, 2024
1 parent 3f760bb commit 118c064
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fastkml/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ class InnerBoundaryIs(_XMLObject):
"""Represents the inner boundary of a polygon in KML."""

_default_nsid = config.KML
kml_geometry: LinearRing
kml_geometry: Optional[LinearRing]

def __init__(
self,
Expand All @@ -932,7 +932,7 @@ def __init__(
name_spaces : Optional[Dict[str, str]], optional
The namespace dictionary for the KML element, by default None.
geometry : Optional[geo.LinearRing], optional
The geometrY to be converted to a KML geometry, by default None.
The geometry to be converted to a KML geometry, by default None.
kml_geometry : Optional[LinearRing], optional
The KML geometry, by default None.
**kwargs : Any
Expand Down
10 changes: 9 additions & 1 deletion tests/geometries/boundaries_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ def test_inner_boundary(self) -> None:
kml_geometry=LinearRing(kml_coordinates=Coordinates(coords=coords)),
)

assert inner_boundary.geometry == geo.LinearRing(coords)
def test_inner_boundary(self) -> None:
"""Test the init method and __bool__."""
coords = ((1, 2), (2, 0), (0, 0), (1, 2))
inner_boundary = InnerBoundaryIs(
kml_geometry=LinearRing(kml_coordinates=Coordinates(coords=coords)),
)

assert inner_boundary.geometry == geo.LinearRing(coords)
assert bool(inner_boundary) is True
assert inner_boundary.to_string(prettyprint=False).strip() == (
'<kml:innerBoundaryIs xmlns:kml="http://www.opengis.net/kml/2.2">'
"<kml:LinearRing><kml:coordinates>"
Expand Down
2 changes: 2 additions & 0 deletions tests/geometries/polygon_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def test_empty_polygon(self) -> None:

assert not polygon.geometry
assert polygon.outer_boundary is not None
assert isinstance(polygon.outer_boundary, LinearRing)
assert len(polygon.inner_boundaries) == 0
assert "tessellate>1</" in polygon.to_string()


Expand Down

0 comments on commit 118c064

Please sign in to comment.