fix(регион): учитывать отказ и нумерованный ТЕР

This commit is contained in:
Hermes
2026-11-26 16:24:03 +10:00
parent 4ed49c1f49
commit a014125c22
5 changed files with 45 additions and 5 deletions
+19
View File
@@ -2099,3 +2099,22 @@ def test_lookup_database_path_with_uri_metacharacters(tmp_path, monkeypatch):
result = regional_ref.lookup("01-01-001-01", subject_id=337, kind="ТЕР", db=unusual,
registry=tmp_path / "reference_sources.json")
assert result["status"] == "ok" and result["price"] == 3270.04, result
def test_ter_not_required_excludes_its_price(tmp_path, monkeypatch):
"""«Не требуется» — обычная форма отказа от вида расценки."""
_env_two_kinds(tmp_path, monkeypatch, term_first=True)
fact = main._regional_fact(
"ТЕР не требуется; нужна ТЕРм для 01-01-001-01 в Оренбургской области")
assert fact and '"kind": "ТЕРм"' in fact and '"price": 200.0' in fact, fact
assert '"price": 100.0' not in fact, fact
def test_numbered_line_with_ter_prefix_keeps_code(tmp_path, monkeypatch):
"""Номер пункта перед «ТЕР-<код>» не делает сам код частью иного числа."""
_env_two_codes(tmp_path, monkeypatch)
fact = main._regional_fact(
"1.ТЕР-01-01-001-01 по Оренбургской области — сколько стоит?")
assert fact and '"code": "01-01-001-01"' in fact and '"price": 3270.04' in fact, fact
assert main._regional_fact(
"2.01-01-001-01 по Оренбургской области — сколько стоит?") is None