Add uv.lock and bump mypy target to 3.12
Adds the uv lockfile generated from pyproject.toml and updates tool.mypy.python_version to 3.12 so third-party stubs parse cleanly while keeping runtime compatibility at Python 3.11.
This commit is contained in:
+4
-1
@@ -41,7 +41,10 @@ asyncio_mode = "auto"
|
|||||||
pythonpath = ["src"]
|
pythonpath = ["src"]
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.11"
|
# Checked against Python 3.12 (the project's venv interpreter) so that third-party
|
||||||
|
# stubs using newer syntax (e.g. numpy >= 2.5) parse cleanly. The code itself
|
||||||
|
# must stay compatible with the 3.11 minimum declared in `requires-python`.
|
||||||
|
python_version = "3.12"
|
||||||
strict = true
|
strict = true
|
||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unused_ignores = true
|
warn_unused_ignores = true
|
||||||
|
|||||||
@@ -70,3 +70,17 @@ async def test_vlm_classifier_fallback(blank_image: Image.Image) -> None:
|
|||||||
result = await classify_document(Path("unknown.png"), [blank_image], client, Settings())
|
result = await classify_document(Path("unknown.png"), [blank_image], client, Settings())
|
||||||
assert result.category == DocumentClass.handwritten
|
assert result.category == DocumentClass.handwritten
|
||||||
assert result.confidence == 0.91
|
assert result.confidence == 0.91
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_empty_pages_raises() -> None:
|
||||||
|
"""The VLM fallback must fail cleanly for documents with no renderable pages."""
|
||||||
|
from odoo_ocr.config import Settings
|
||||||
|
from tests.conftest import FakeVLMClient
|
||||||
|
|
||||||
|
client = FakeVLMClient()
|
||||||
|
with (
|
||||||
|
patch("odoo_ocr.pipeline.classifier._heuristic_classify", return_value=None),
|
||||||
|
pytest.raises(ValueError, match="no renderable pages"),
|
||||||
|
):
|
||||||
|
await classify_document(Path("empty.pdf"), [], client, Settings())
|
||||||
|
|||||||
Reference in New Issue
Block a user