csv-parser: add _fingerprint helper
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
f3fd769b3b
commit
f8a0ed3923
2 changed files with 67 additions and 0 deletions
|
|
@ -29,3 +29,28 @@ def test_csv_format_template_model_columns():
|
|||
# Fingerprint is the cache key.
|
||||
assert cols["fingerprint"].unique is True
|
||||
assert cols["fingerprint"].nullable is False
|
||||
|
||||
|
||||
def test_fingerprint_stable_across_case_and_whitespace():
|
||||
from app.services.llm_csv_parser import _fingerprint
|
||||
|
||||
a = _fingerprint(["Symbol", "Quantity", "Avg Price"])
|
||||
b = _fingerprint(["symbol", "quantity", "avg price"])
|
||||
c = _fingerprint([" SYMBOL ", "Quantity", " AVG PRICE"])
|
||||
assert a == b == c
|
||||
|
||||
|
||||
def test_fingerprint_differs_for_different_columns():
|
||||
from app.services.llm_csv_parser import _fingerprint
|
||||
|
||||
a = _fingerprint(["Symbol", "Quantity"])
|
||||
b = _fingerprint(["Symbol", "Quantity", "Avg Price"])
|
||||
assert a != b
|
||||
|
||||
|
||||
def test_fingerprint_is_sha256_hex_64_chars():
|
||||
from app.services.llm_csv_parser import _fingerprint
|
||||
|
||||
f = _fingerprint(["Symbol", "Quantity"])
|
||||
assert len(f) == 64
|
||||
assert all(c in "0123456789abcdef" for c in f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue