diff --git a/fastkml/geometry.py b/fastkml/geometry.py index ec0c85f6..343df712 100644 --- a/fastkml/geometry.py +++ b/fastkml/geometry.py @@ -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, @@ -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 diff --git a/tests/geometries/boundaries_test.py b/tests/geometries/boundaries_test.py index adf27b43..181bb066 100644 --- a/tests/geometries/boundaries_test.py +++ b/tests/geometries/boundaries_test.py @@ -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() == ( '' "" diff --git a/tests/geometries/polygon_test.py b/tests/geometries/polygon_test.py index 935aa86d..7cb8dae2 100644 --- a/tests/geometries/polygon_test.py +++ b/tests/geometries/polygon_test.py @@ -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