style: apply ruff format to OCR modules
This commit is contained in:
@@ -249,14 +249,20 @@ class TestMiddleJsonDefense:
|
||||
self._expect_invalid(_zip_bytes(_middle_bytes([page])))
|
||||
|
||||
def test_bbox_order_invalid(self):
|
||||
self._expect_invalid(_zip_bytes(_middle_bytes([_page([_block("table", (218, 48, 41, 282))])])))
|
||||
self._expect_invalid(
|
||||
_zip_bytes(_middle_bytes([_page([_block("table", (218, 48, 41, 282))])]))
|
||||
)
|
||||
|
||||
def test_bbox_int_degenerate(self):
|
||||
# float 合法但 int() 后宽度为零: 专为 CHS shim 的裁剪路径兜底
|
||||
self._expect_invalid(_zip_bytes(_middle_bytes([_page([_block("table", (1.2, 1.2, 1.8, 5))])])))
|
||||
self._expect_invalid(
|
||||
_zip_bytes(_middle_bytes([_page([_block("table", (1.2, 1.2, 1.8, 5))])]))
|
||||
)
|
||||
|
||||
def test_bbox_non_finite(self):
|
||||
self._expect_invalid(_zip_bytes(_middle_bytes([_page([_block("table", (1, 2, float("inf"), 4))])])))
|
||||
self._expect_invalid(
|
||||
_zip_bytes(_middle_bytes([_page([_block("table", (1, 2, float("inf"), 4))])]))
|
||||
)
|
||||
|
||||
def test_type_missing(self):
|
||||
block = {"bbox": [1, 2, 30, 40], "index": 0}
|
||||
@@ -278,8 +284,13 @@ class TestMiddleJsonDefense:
|
||||
class TestErrorTranslation:
|
||||
@pytest.mark.parametrize(
|
||||
("status", "exc_type"),
|
||||
[(502, TransientError), (429, TransientError), (401, SourceDeadError),
|
||||
(403, SourceDeadError), (404, RequestRejectedError)],
|
||||
[
|
||||
(502, TransientError),
|
||||
(429, TransientError),
|
||||
(401, SourceDeadError),
|
||||
(403, SourceDeadError),
|
||||
(404, RequestRejectedError),
|
||||
],
|
||||
)
|
||||
async def test_http_status(self, status, exc_type):
|
||||
t = _transport_for(_routes(text_resp=httpx.Response(status)))
|
||||
|
||||
Reference in New Issue
Block a user