import os.path import pytest from image_prediction.predictor import Predictor @pytest.fixture def predictions(): return [ { "class": "signature", "probabilities": { "signature": 1.0, "logo": 9.150285377746546e-19, "other": 4.374506412383356e-19, "formula": 3.582569597002796e-24, }, } ] @pytest.fixture def metadata(): return [ { "page_height": 612.0, "page_width": 792.0, "height": 61.049999999999955, "width": 139.35000000000002, "page_idx": 8, "x1": 63.5, "x2": 202.85000000000002, "y1": 472.0, "y2": 533.05, } ] @pytest.fixture def response(): return [ { "classification": { "label": "signature", "probabilities": {"formula": 0.0, "logo": 0.0, "other": 0.0, "signature": 1.0}, }, "filters": { "allPassed": True, "geometry": { "imageFormat": {"quotient": 2.282555282555285, "tooTall": False, "tooWide": False}, "imageSize": {"quotient": 0.13248234868245012, "tooLarge": False, "tooSmall": False}, }, "probability": {"unconfident": False}, }, "geometry": {"height": 61.049999999999955, "width": 139.35000000000002}, "position": {"pageNumber": 9, "x1": 63.5, "x2": 202.85000000000002, "y1": 472.0, "y2": 533.05}, } ] @pytest.fixture def predictor(): return Predictor() @pytest.fixture def test_pdf(): with open("./test/test_data/f2dc689ca794fccb8cd38b95f2bf6ba9.pdf", "rb") as f: return f.read()