"""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