From e75a08f2ea20796b6775f48707be779ddb11aa8e Mon Sep 17 00:00:00 2001 From: AdrienWehrle Date: Tue, 3 Dec 2024 14:08:30 +0100 Subject: [PATCH] bring tests out of file context --- tests/test_earthspy.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/test_earthspy.py b/tests/test_earthspy.py index 48adc81..94fab87 100644 --- a/tests/test_earthspy.py +++ b/tests/test_earthspy.py @@ -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"""