"""Extractor unit tests — error paths only (real extraction is integration).""" from __future__ import annotations from pathlib import Path import pytest from contract_check.core.analysis.extractor import SUPPORTED_SUFFIXES, ExtractionError, extract_text def test_missing_file_raises(tmp_path: Path) -> None: with pytest.raises(ExtractionError, match="не найден"): extract_text(tmp_path / "nope.pdf") def test_unsupported_suffix_raises(tmp_path: Path) -> None: f = tmp_path / "contract.txt" f.write_text("hello" * 50) with pytest.raises(ExtractionError, match="Неподдерживаемый формат"): extract_text(f) def test_supported_suffixes_cover_pdf_docx() -> None: assert {".pdf", ".docx"} <= SUPPORTED_SUFFIXES