Skip to content

Commit

Permalink
dev: add failing test for colorization of single point cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesGaydon committed Aug 8, 2023
1 parent 6245222 commit 3cca39a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Binary file not shown.
23 changes: 20 additions & 3 deletions test/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ def setup_module(module):

TEST_PATH = os.path.dirname(os.path.abspath(__file__))
INPUT_PATH = os.path.join(TEST_PATH, "data/test_noepsg_043500_629205_IGN69.laz")
INPUT_PATH_SINGLE_POINT_CLOUD = os.path.join(
TEST_PATH, "data/test_data_0436_6384_LA93_IGN69_single_point.laz"
)

OUTPUT_FILE = TMPDIR + "Semis_2021_0435_6292_LA93_IGN69.las"
OUTPUT_FILE_SINGLE_POINT_CLOUD = (
TMPDIR + "test_data_0436_6384_LA93_IGN69_single_point.colorized.laz"
)


@pytest.mark.geoportail
def test_epsg_fail():
with pytest.raises(requests.exceptions.HTTPError, match="400 Client Error: BadRequest for url"):
with pytest.raises(
requests.exceptions.HTTPError, match="400 Client Error: BadRequest for url"
):
color.color(INPUT_PATH, OUTPUT_FILE, "", 0.1, 15)


Expand All @@ -48,16 +56,25 @@ def test_color_and_keeping_orthoimages():
assert Path(tmp_ortho_irc).exists()


def test_color_narrow_cloud():
# Test that clouds that are smaller in width or height to 20cm are still clorized without an error.
color.color(INPUT_PATH_SINGLE_POINT_CLOUD, OUTPUT_FILE_SINGLE_POINT_CLOUD, epsg)


@pytest.mark.geoportail
def test_download_image_ok():
color.download_image_from_geoportail(epsg, layer, minx, miny, maxx, maxy, pixel_per_meter, OUTPUT_FILE, 15)
color.download_image_from_geoportail(
epsg, layer, minx, miny, maxx, maxy, pixel_per_meter, OUTPUT_FILE, 15
)


@pytest.mark.geoportail
def test_download_image_raise1():
retry_download = color.retry(2, 5)(color.download_image_from_geoportail)
with pytest.raises(requests.exceptions.HTTPError):
retry_download(epsg, "MAUVAISE_COUCHE", minx, miny, maxx, maxy, pixel_per_meter, OUTPUT_FILE, 15)
retry_download(
epsg, "MAUVAISE_COUCHE", minx, miny, maxx, maxy, pixel_per_meter, OUTPUT_FILE, 15
)


@pytest.mark.geoportail
Expand Down

0 comments on commit 3cca39a

Please sign in to comment.