add response test
This commit is contained in:
parent
2a2deffd0b
commit
90e3058c71
55
test/conftest.py
Normal file
55
test/conftest.py
Normal file
@ -0,0 +1,55 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@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},
|
||||
}
|
||||
]
|
||||
5
test/test_response.py
Normal file
5
test/test_response.py
Normal file
@ -0,0 +1,5 @@
|
||||
from image_prediction.response import build_response
|
||||
|
||||
|
||||
def test_build_response_returns_valid_response(predictions, metadata, response):
|
||||
assert build_response(predictions, metadata) == response
|
||||
Loading…
x
Reference in New Issue
Block a user