add tests (#18)

* add tests

* add sentencepiece dependency
This commit is contained in:
Maciej Budyś
2022-11-03 21:01:36 +01:00
committed by GitHub
parent 71fe10621a
commit 6309289958
18 changed files with 93 additions and 0 deletions

16
tests/test_ocr.py Normal file
View File

@@ -0,0 +1,16 @@
import json
from pathlib import Path
from manga_ocr import MangaOcr
TEST_DATA_ROOT = Path(__file__).parent / 'data'
def test_ocr():
mocr = MangaOcr()
expected_results = json.loads((TEST_DATA_ROOT / 'expected_results.json').read_text(encoding='utf-8'))
for item in expected_results:
result = mocr(TEST_DATA_ROOT / 'images' / item['filename'])
assert result == item['result']