From 58ca784d6c56fd63734062d0c40b6b39550cf7d7 Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Mon, 21 Mar 2022 10:21:38 +0100 Subject: [PATCH] fix test --- test/unit_tests/test_predictor.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/unit_tests/test_predictor.py b/test/unit_tests/test_predictor.py index 0523adf..707c9a2 100644 --- a/test/unit_tests/test_predictor.py +++ b/test/unit_tests/test_predictor.py @@ -1,11 +1,16 @@ def test_predict_pdf_works(predictor, test_pdf): + # FIXME strange outputs, with '\n's in the dict predictions, metadata = predictor.predict_pdf(test_pdf) - assert list(predictions) == [{'class': 'formula', - 'probabilities': {'formula': 1.0, 'other': 1.576210689757148e-17, - 'signature': 5.364939675629517e-24, - 'logo': 8.815339177836606e-25}}] - # FIXME strange output for metadata, with '\n's in the dict + predictions = list(predictions) + predictions = dict(**predictions[0]) + assert predictions == {'class': 'formula', + 'probabilities': {'formula': 1.0, 'other': 1.576210689757148e-17, + 'signature': 5.364939675629517e-24, + 'logo': 8.815339177836606e-25}} metadata = list(metadata) metadata = dict(**metadata[0]) metadata.pop("document_filename") # temp filename cannot be tested - assert metadata == {'px_width': 389.0, 'px_height': 389.0, 'width': 194.49999000000003, 'height': 194.49998999999997, 'x1': 320.861, 'x2': 515.36099, 'y1': 347.699, 'y2': 542.19899, 'page_width': 595.2800000000001, 'page_height': 841.89, 'page_rotation': 0, 'page_idx': 1, 'n_pages': 3} + assert metadata == {'px_width': 389.0, 'px_height': 389.0, 'width': 194.49999000000003, + 'height': 194.49998999999997, 'x1': 320.861, 'x2': 515.36099, 'y1': 347.699, 'y2': 542.19899, + 'page_width': 595.2800000000001, 'page_height': 841.89, 'page_rotation': 0, 'page_idx': 1, + 'n_pages': 3}