feat(nlp-service): wire NLP_FUZZY_THRESHOLD env var with 0-100 validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,23 @@ def test_parse_all_languages(client):
|
||||
assert r.json()["dateTo"] == "1920-12-31", f"Wrong dateTo for lang={lang}"
|
||||
|
||||
|
||||
def test_fuzzy_threshold_valid_range():
|
||||
from main import _parse_fuzzy_threshold
|
||||
assert _parse_fuzzy_threshold("80") == 80
|
||||
assert _parse_fuzzy_threshold("0") == 0
|
||||
assert _parse_fuzzy_threshold("100") == 100
|
||||
|
||||
|
||||
def test_fuzzy_threshold_out_of_range_raises():
|
||||
from main import _parse_fuzzy_threshold
|
||||
with pytest.raises(ValueError):
|
||||
_parse_fuzzy_threshold("101")
|
||||
with pytest.raises(ValueError):
|
||||
_parse_fuzzy_threshold("-1")
|
||||
with pytest.raises(ValueError):
|
||||
_parse_fuzzy_threshold("abc")
|
||||
|
||||
|
||||
def test_parse_exceeds_max_length_returns_422(client):
|
||||
r = client.post("/parse", json={"query": "a" * 501, "lang": "de"})
|
||||
assert r.status_code == 422
|
||||
|
||||
Reference in New Issue
Block a user