Files
smeta-railway/tests/test_fgis.py
T
anorandClaude Opus 4.6 897d2d1b76 refactor: декомпозиция монолита в пакет smeta-railway
- Пакетная структура src/smeta_railway/ с модулями calc/, data/, output/
- Pydantic-конфиг: всё через YAML, сметчик не трогает Python
- EstimateCalculator: ядро расчёта, параметризованные коэффициенты
- FGISLookup: pickle cache (4.7с → ~50мс при повторном запуске)
- CLI: smeta generate/fetch-resources/validate (typer)
- 28 тестов (coefficients, overhead, fgis, estimate)
- Исправлен баг: НР/СП для земляных работ (92%/46% вместо 109%/65%)
- ПЗ совпадают бит-в-бит со старым генератором

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:42:19 +10:00

50 lines
1.4 KiB
Python

"""Tests for FGIS lookup utilities."""
import pytest
from smeta_railway.data.fgis import FGISLookup, get_labor_code, get_labor_current_price
class TestLaborCode:
def test_razryad_30(self):
assert get_labor_code(3.0) == "1-100-30"
def test_razryad_31(self):
assert get_labor_code(3.1) == "1-100-31"
def test_razryad_50(self):
assert get_labor_code(5.0) == "1-100-50"
def test_machinist_50(self):
assert get_labor_code(5.0, "4-100-") == "4-100-050"
def test_machinist_60(self):
assert get_labor_code(6.0, "4-100-") == "4-100-060"
class TestLaborPrice:
def test_default_price(self):
"""Without FGIS data, returns default 545.28."""
fgis = FGISLookup()
price = get_labor_current_price(fgis, 3.0)
assert price == 545.28
def test_with_fgis_data(self):
fgis = FGISLookup(
labor_price_map={"1-100-30": 600.0}
)
price = get_labor_current_price(fgis, 3.0)
assert price == 600.0
class TestFGISLookup:
def test_get_index(self):
fgis = FGISLookup(index_map={"91.09.07-014": 1.64})
assert fgis.get_index("91.09.07-014") == 1.64
assert fgis.get_index("nonexistent") is None
def test_get_base_price(self):
fgis = FGISLookup(base_price_map={"91.09.07-014": 1000.0})
assert fgis.get_base_price("91.09.07-014") == 1000.0
assert fgis.get_base_price("nonexistent", 0) == 0