Skip to content

Commit

Permalink
🧪 Add unit test to read GeoTIFF from remote http url
Browse files Browse the repository at this point in the history
Doing test driven development by trying to load a remote GeoTIFF file via http into a numpy array.
  • Loading branch information
weiji14 committed Mar 1, 2024
1 parent 98a75fc commit 6cc8f4b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion python/tests/test_io_geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from cog3pio import read_geotiff


# %%
@pytest.fixture(scope="module", name="geotiff_path")
def fixture_geotiff_path():
"""
Expand All @@ -31,3 +31,15 @@ def test_read_geotiff_local(geotiff_path):
array = read_geotiff(path=geotiff_path)
assert array.shape == (20, 20)
assert array.dtype == "float32"


@pytest.mark.benchmark
def test_read_geotiff_remote():
"""
Read a GeoTIFF file from a remote URL.
"""
array = read_geotiff(
path="https://github.com/pka/georaster/raw/v0.1.0/data/tiff/float32.tif"
)
assert array.shape == (20, 20)
assert array.dtype == "float32"

0 comments on commit 6cc8f4b

Please sign in to comment.