Skip to content

Commit

Permalink
bring tests out of file context
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienWehrle committed Dec 3, 2024
1 parent de8a358 commit e75a08f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tests/test_earthspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,24 +345,22 @@ def test_geojson(self) -> None:
with open(file, "r+") as f:
data = json.load(f)

# extract coordinates of geometry nodes
geometry_coordinates = np.array(
data["features"][0]["geometry"]["coordinates"][0]
)
# extract coordinates of geometry nodes
geometry_coordinates = np.array(
data["features"][0]["geometry"]["coordinates"][0]
)

# check if feature is a polygon
assert data["features"][0]["geometry"]["type"] == "Polygon"
# check if feature is a polygon
assert data["features"][0]["geometry"]["type"] == "Polygon"

# check if coordinates match a 4-point square
assert geometry_coordinates.shape == (5, 2)
# check if coordinates match a 4-point square
assert geometry_coordinates.shape == (5, 2)

# check if the coordinates are valid longitude/latitude coordinates
assert (
(geometry_coordinates >= -90) & (geometry_coordinates <= 90)
).all()
# check if the coordinates are valid longitude/latitude coordinates
assert ((geometry_coordinates >= -90) & (geometry_coordinates <= 90)).all()

# check if first coordinate is repeated on the last element
assert geometry_coordinates[0, 0] == geometry_coordinates[-1, 0]
# check if first coordinate is repeated on the last element
assert geometry_coordinates[0, 0] == geometry_coordinates[-1, 0]

def test_rename_output_files(self) -> None:
"""Test output renaming"""
Expand Down

0 comments on commit e75a08f

Please sign in to comment.