Files
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

36 lines
1.1 KiB
Python

"""Tests for overhead calculation."""
import pytest
from smeta_railway.calc.overhead import calc_overhead, get_overhead_percents
class TestOverhead:
def test_railway_percents(self):
nr_pct, sp_pct, *_ = get_overhead_percents("ГЭСН 28-01-037-02")
assert nr_pct == 109
assert sp_pct == 65
def test_earthwork_percents(self):
nr_pct, sp_pct, *_ = get_overhead_percents("ГЭСН 01-02-057-02")
assert nr_pct == 92
assert sp_pct == 46
def test_calc_overhead(self):
fot = 100_000.0
nr, sp = calc_overhead(fot, 109, 65)
assert nr == 109_000.0
assert sp == 65_000.0
def test_calc_overhead_rounding(self):
fot = 12345.67
nr, sp = calc_overhead(fot, 109, 65)
assert nr == pytest.approx(13456.78, abs=0.01)
assert sp == pytest.approx(8024.69, abs=0.01)
def test_railway_labels(self):
_, _, nr_code, nr_label, sp_code, sp_label = get_overhead_percents("ГЭСН 28-01-031-01")
assert "812" in nr_code
assert "774" in sp_code
assert "Железные дороги" in nr_label