generated from dopt-python/py311
add anomaly threshold as parameter, related to #20
This commit is contained in:
@@ -104,6 +104,7 @@ def test_isolated_pipeline(results_folder, path_img_with_failure_TrainedModel):
|
||||
detection_models=DETECTION_MODELS,
|
||||
data_csv=data_csv,
|
||||
sensor_images=sensor_images,
|
||||
anomaly_threshold=constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
# check files for existence
|
||||
root_img = path_img_with_failure_TrainedModel.parent
|
||||
@@ -124,7 +125,12 @@ def test_full_pipeline_wrapped_FailImagePath(setup_temp_dir):
|
||||
pixels_per_metric_X: float = 0.251
|
||||
pixels_per_metric_Y: float = 0.251
|
||||
|
||||
ret = detect.pipeline(img_path, pixels_per_metric_X, pixels_per_metric_Y)
|
||||
ret = detect.pipeline(
|
||||
img_path,
|
||||
pixels_per_metric_X,
|
||||
pixels_per_metric_Y,
|
||||
constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
assert ret.status != result_pattern.STATUS_HANDLER.SUCCESS
|
||||
assert ret.status.ExceptionType is FileNotFoundError
|
||||
assert ret.status.message == MESSAGE
|
||||
@@ -140,7 +146,12 @@ def test_full_pipeline_wrapped_FailElectrodeCount(path_img_with_failure_Electrod
|
||||
pixels_per_metric_X: float = 0.251
|
||||
pixels_per_metric_Y: float = 0.251
|
||||
|
||||
ret = detect.pipeline(img_path, pixels_per_metric_X, pixels_per_metric_Y)
|
||||
ret = detect.pipeline(
|
||||
img_path,
|
||||
pixels_per_metric_X,
|
||||
pixels_per_metric_Y,
|
||||
constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
assert ret.status != result_pattern.STATUS_HANDLER.SUCCESS
|
||||
assert ret.status.ExceptionType is errors.InvalidElectrodeCount
|
||||
assert MESSAGE in ret.status.message
|
||||
@@ -164,7 +175,12 @@ def test_full_pipeline_wrapped_Success(results_folder, path_img_with_failure_Tra
|
||||
pixels_per_metric_X: float = 0.251
|
||||
pixels_per_metric_Y: float = 0.251
|
||||
|
||||
ret = detect.pipeline(img_path, pixels_per_metric_X, pixels_per_metric_Y)
|
||||
ret = detect.pipeline(
|
||||
img_path,
|
||||
pixels_per_metric_X,
|
||||
pixels_per_metric_Y,
|
||||
constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
assert ret.status == result_pattern.STATUS_HANDLER.SUCCESS
|
||||
assert ret.status.code == 0
|
||||
assert ret.status.ExceptionType is None
|
||||
|
||||
@@ -54,7 +54,10 @@ def test_sensor_anomalies_detection_FailImagePath(setup_temp_dir):
|
||||
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_err:
|
||||
ret = _interface.sensor_anomalies_detection(
|
||||
img_path, pixels_per_metric_X, pixels_per_metric_Y
|
||||
img_path,
|
||||
pixels_per_metric_X,
|
||||
pixels_per_metric_Y,
|
||||
constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
captured = mock_err.getvalue()
|
||||
assert ret != 0
|
||||
@@ -72,7 +75,10 @@ def test_sensor_anomalies_detection_FailElectrodeCount(path_img_with_failure_Ele
|
||||
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_err:
|
||||
ret = _interface.sensor_anomalies_detection(
|
||||
img_path, pixels_per_metric_X, pixels_per_metric_Y
|
||||
img_path,
|
||||
pixels_per_metric_X,
|
||||
pixels_per_metric_Y,
|
||||
constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
captured = mock_err.getvalue()
|
||||
assert ret != 0
|
||||
@@ -99,7 +105,10 @@ def test_sensor_anomalies_detection_Success(
|
||||
pixels_per_metric_Y: float = 0.251
|
||||
|
||||
ret = _interface.sensor_anomalies_detection(
|
||||
img_path, pixels_per_metric_X, pixels_per_metric_Y
|
||||
img_path,
|
||||
pixels_per_metric_X,
|
||||
pixels_per_metric_Y,
|
||||
constants.ANOMALY_THRESHOLD_DEFAULT,
|
||||
)
|
||||
|
||||
assert ret == 0
|
||||
|
||||
Reference in New Issue
Block a user