diff --git a/tests/test_wechat_local_ocr.py b/tests/test_wechat_local_ocr.py index eb41b71..c787fc9 100755 --- a/tests/test_wechat_local_ocr.py +++ b/tests/test_wechat_local_ocr.py @@ -526,7 +526,11 @@ class OcrFallbackTests(unittest.TestCase): captured.update(kwargs) fake_module = types.SimpleNamespace(RapidOCR=FakeRapidOCR) - with mock.patch.dict(sys.modules, {"rapidocr": fake_module}), mock.patch.dict( + fake_numpy = types.SimpleNamespace(array=lambda value: value) + with mock.patch.dict( + sys.modules, + {"rapidocr": fake_module, "numpy": fake_numpy}, + ), mock.patch.dict( MODULE.os.environ, { "WECHAT_OCR_ONNX_INTRA_OP_THREADS": "", @@ -551,7 +555,11 @@ class OcrFallbackTests(unittest.TestCase): captured.update(kwargs) fake_module = types.SimpleNamespace(RapidOCR=FakeRapidOCR) - with mock.patch.dict(sys.modules, {"rapidocr": fake_module}), mock.patch.dict( + fake_numpy = types.SimpleNamespace(array=lambda value: value) + with mock.patch.dict( + sys.modules, + {"rapidocr": fake_module, "numpy": fake_numpy}, + ), mock.patch.dict( MODULE.os.environ, { "WECHAT_OCR_ONNX_INTRA_OP_THREADS": "2",