22 lines
676 B
Python
22 lines
676 B
Python
import pytest
|
|
|
|
from image_prediction.transformer.transformers.response import is_max_image_to_page_quotient_breached
|
|
|
|
|
|
@pytest.fixture
|
|
def expected_is_breached(quotient, label):
|
|
if label == "signature" and quotient < 0.4:
|
|
return False
|
|
elif label == "signature" and quotient >= 0.4:
|
|
return True
|
|
elif quotient < 0.7:
|
|
return False
|
|
else:
|
|
return True
|
|
|
|
|
|
@pytest.mark.parametrize("quotient", [0.1, 0.5])
|
|
@pytest.mark.parametrize("label", ["logo", "signature"])
|
|
def test_customized_per_label_ratio_breach(quotient, label, expected_is_breached):
|
|
assert is_max_image_to_page_quotient_breached(quotient, label) == expected_is_breached
|