csv-parser: add CsvFormatTemplate model
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
08b4dddcdd
commit
3f1d2a1034
2 changed files with 66 additions and 0 deletions
31
tests/test_llm_csv_parser.py
Normal file
31
tests/test_llm_csv_parser.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"""Unit + integration tests for the LLM-fallback CSV parser."""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_csv_format_template_model_columns():
|
||||
"""Model exposes every column the spec requires, with correct types."""
|
||||
from sqlalchemy import inspect
|
||||
|
||||
from app.models import CsvFormatTemplate
|
||||
|
||||
cols = {c.name: c for c in inspect(CsvFormatTemplate).columns}
|
||||
assert "fingerprint" in cols
|
||||
assert "headers" in cols
|
||||
assert "sample_row" in cols
|
||||
assert "mapping" in cols
|
||||
assert "preamble_rows" in cols
|
||||
assert "delimiter" in cols
|
||||
assert "broker_label" in cols
|
||||
assert "first_seen_at" in cols
|
||||
assert "use_count" in cols
|
||||
assert "last_used_at" in cols
|
||||
assert "llm_model" in cols
|
||||
assert "llm_cost_usd" in cols
|
||||
# Crucially, no user attribution.
|
||||
assert "user_id" not in cols
|
||||
assert "first_seen_user_id" not in cols
|
||||
# Fingerprint is the cache key.
|
||||
assert cols["fingerprint"].unique is True
|
||||
assert cols["fingerprint"].nullable is False
|
||||
Loading…
Add table
Add a link
Reference in a new issue