43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Shared fixtures for pytest — contracts-flask decoupling tests."""
|
|
import pytest
|
|
import sys
|
|
import os
|
|
|
|
# Ensure deploy/ is on path for imports
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
|
|
from compare.llm_client import FakeLLMClient
|
|
from repository import MemRepository
|
|
|
|
|
|
@pytest.fixture
|
|
def fake_llm():
|
|
"""Fake LLM client with pre-registered responses."""
|
|
client = FakeLLMClient()
|
|
client.add("default", '{"doc_type":"contract","own_number":"03700_1","doc_date":"2026-02-01","counterparty":"ЗАО XXX001"}')
|
|
return client
|
|
|
|
|
|
@pytest.fixture
|
|
def mem_repo():
|
|
"""In-memory repository for unit tests."""
|
|
return MemRepository()
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_docx_bytes():
|
|
"""Minimal test bytes — not a real DOCX, just for multipart tests."""
|
|
return b"FAKE_DOCX_CONTENT"
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_classify_response():
|
|
"""Sample LLM classify response."""
|
|
return {
|
|
"doc_type": "contract",
|
|
"own_number": "03700_1",
|
|
"parent_number": None,
|
|
"doc_date": "2026-02-01",
|
|
"counterparty": "ЗАО XXX001",
|
|
}
|