import dataclasses import pytest from perfkit.gen.plan import GenPlan, plan_for_scale def test_plan_scale2_doubles_volume(): p1, p2 = plan_for_scale(1), plan_for_scale(2) for name in ("org_units_rf", "vsp_per_rf", "extra_lines_per_sheet", "projects_per_rf"): assert getattr(p2, name) == 2 * getattr(p1, name), name assert p2.fill_ratio == p1.fill_ratio def test_plan_rejects_zero_scale(): with pytest.raises(ValueError): plan_for_scale(0) def test_plan_scale1_fields_and_biggest_sheet(): p = plan_for_scale(1) assert {f.name for f in dataclasses.fields(GenPlan)} >= { "org_units_ssp", "org_units_rf", "vsp_per_rf", "extra_lines_per_sheet", "projects_per_rf", "fill_ratio", } # самый большой лист rf (FORM_2/AHR: 566 строк шаблона + extra) не меньше 1000 строк assert 566 + p.extra_lines_per_sheet >= 1000 assert p.org_units_rf >= 1 and p.org_units_ssp >= 1 assert 0 < p.fill_ratio <= 1 def test_plan_rejects_negative_scale(): with pytest.raises(ValueError): plan_for_scale(-1)