Skip to content

Commit

Permalink
Merge branch '91-plan-de-validation-test-sur-la-roi' into 'release'
Browse files Browse the repository at this point in the history
Resolve "Plan de validation : test sur la ROI"

See merge request 3d/PandoraBox/pandora2d!93
  • Loading branch information
lecontm committed Apr 11, 2024
2 parents 43a4b82 + 8b89e39 commit 7e450ed
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions tests/unit_tests/test_check_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
Test configuration
"""


import pytest
import transitions
import numpy as np
import xarray as xr
from json_checker import DictCheckerError
from json_checker import DictCheckerError, MissKeyCheckerError

from pandora2d.img_tools import create_datasets_from_inputs, add_disparity_grid
from pandora2d import check_configuration
Expand Down Expand Up @@ -148,6 +147,10 @@ def test_false_disp_dict_should_raise_error(self, pandora2d_machine, false_pipel
class TestCheckRoiSection:
"""Test check_roi_section."""

def test_expect_roi_section(self):
with pytest.raises(MissKeyCheckerError, match="ROI"):
check_configuration.check_roi_section({"input": {}})

def test_nominal_case(self, correct_roi_sensor) -> None:
"""
Test function for checking user ROI section
Expand All @@ -163,6 +166,42 @@ def test_first_dimension_gt_last_dimension_raises_exception(self, false_roi_sens
with pytest.raises(BaseException):
check_configuration.check_roi_section(false_roi_sensor_first_superior_to_last)

@pytest.mark.parametrize(
"roi_section",
[
pytest.param(
{
"ROI": {
"col": {"first": 10, "last": 10},
"row": {"first": 10, "last": 100},
},
},
id="Only col",
),
pytest.param(
{
"ROI": {
"col": {"first": 10, "last": 100},
"row": {"first": 10, "last": 10},
},
},
id="Only row",
),
pytest.param(
{
"ROI": {
"col": {"first": 10, "last": 10},
"row": {"first": 10, "last": 10},
},
},
id="Both row and col",
),
],
)
def test_one_pixel_roi_is_valid(self, roi_section):
"""Should not raise error."""
check_configuration.check_roi_section(roi_section)


def test_get_roi_pipeline(
correct_roi_sensor,
Expand Down

0 comments on commit 7e450ed

Please sign in to comment.