Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Oct 2, 2024
1 parent 118c064 commit fd61d0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion fastkml/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ class Polygon(_Geometry):
"""

outer_boundary: Optional[OuterBoundaryIs]
inner_boundaries: Optional[List[InnerBoundaryIs]]
inner_boundaries: List[InnerBoundaryIs]

def __init__(
self,
Expand Down
12 changes: 3 additions & 9 deletions tests/geometries/boundaries_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,13 @@ def test_read_outer_boundary(self) -> None:
def test_inner_boundary(self) -> None:
"""Test the init method."""
coords = ((1, 2), (2, 0), (0, 0), (1, 2))

inner_boundary = InnerBoundaryIs(
kml_geometry=LinearRing(kml_coordinates=Coordinates(coords=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.geometry == geo.LinearRing(coords)
assert bool(inner_boundary)
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
3 changes: 2 additions & 1 deletion tests/geometries/polygon_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import pygeoif.geometry as geo

from fastkml.geometry import OuterBoundaryIs
from fastkml.geometry import Polygon
from tests.base import Lxml
from tests.base import StdLibrary
Expand Down Expand Up @@ -180,7 +181,7 @@ def test_empty_polygon(self) -> None:

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

Expand Down

0 comments on commit fd61d0b

Please sign in to comment.