Skip to content

Commit

Permalink
And add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rhugonnet committed Jun 7, 2024
1 parent e663a36 commit 389b961
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/test_pointcloud.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test module for point cloud functionalities."""

import pytest
import geopandas as gpd
import numpy as np
import rasterio as rio
Expand All @@ -10,7 +11,7 @@


class TestPointCloud:
def test_grid_pc__chull(self) -> None:
def test_grid_pc(self) -> None:
"""Test point cloud gridding."""

# 1/ Check gridding interpolation falls back exactly on original raster
Expand Down Expand Up @@ -105,3 +106,11 @@ def test_grid_pc__chull(self) -> None:
ifarchull, jfarchull = list(zip(*far_in_chull))

assert all(~np.isfinite(gridded_pc[ifarchull, jfarchull]))

# 3/ Errors
with pytest.raises(TypeError, match="Input grid coordinates must be 1D arrays.*"):
Raster.from_pointcloud_regular(pc, grid_coords=(1, "lol")) # type: ignore
with pytest.raises(ValueError, match="Grid coordinates must be regular*"):
grid_coords[0][0] += 1
Raster.from_pointcloud_regular(pc, grid_coords=grid_coords) # type: ignore

0 comments on commit 389b961

Please sign in to comment.