mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-13 22:40:53 +08:00
Fix bugs of inputting paramters with class instance
This commit is contained in:
1 parent
220390dfc3
commit
86ce4ceca3
4 files changed
+114
-73
No files matched your search
@@ -61,3 +61,38 @@ def test_input_path():
|
||||
result, _ = rapid_ocr(image_path)
|
||||
assert result[0][1] == '正品促销'
|
||||
assert len(result) == 17
|
||||
|
||||
|
||||
def test_input_parameters():
|
||||
image_path = tests_dir / 'ch_en_num.jpg'
|
||||
rapid_ocr = RapidOCR(text_score=1)
|
||||
result, _ = rapid_ocr(image_path)
|
||||
|
||||
assert result is None
|
||||
|
||||
|
||||
def test_input_det_parameters():
|
||||
image_path = tests_dir / 'ch_en_num.jpg'
|
||||
with pytest.raises(FileNotFoundError) as exc_info:
|
||||
rapid_ocr = RapidOCR(det_model_path='1.onnx')
|
||||
result, _ = rapid_ocr(image_path)
|
||||
raise FileNotFoundError()
|
||||
assert exc_info.type is FileNotFoundError
|
||||
|
||||
|
||||
def test_input_cls_parameters():
|
||||
image_path = tests_dir / 'ch_en_num.jpg'
|
||||
with pytest.raises(FileNotFoundError) as exc_info:
|
||||
rapid_ocr = RapidOCR(cls_model_path='1.onnx')
|
||||
result, _ = rapid_ocr(image_path)
|
||||
raise FileNotFoundError()
|
||||
assert exc_info.type is FileNotFoundError
|
||||
|
||||
|
||||
def test_input_rec_parameters():
|
||||
image_path = tests_dir / 'ch_en_num.jpg'
|
||||
with pytest.raises(FileNotFoundError) as exc_info:
|
||||
rapid_ocr = RapidOCR(rec_model_path='1.onnx')
|
||||
result, _ = rapid_ocr(image_path)
|
||||
raise FileNotFoundError()
|
||||
assert exc_info.type is FileNotFoundError
|
||||
Reference in new issue
Block a user