from gpu_rent.config import load_config from gpu_rent.inventory import FlavorInfo from gpu_rent.ux import cost_and_risk_lines, format_flavor_lines def test_format_flavor_lines_marks_pick(): ranked = [ FlavorInfo("a", "RTX 4090 24GB", 8, 32768, False, {}, "4090-24"), FlavorInfo("b", "A5000", 8, 32768, False, {}, "a5000"), ] picked = ranked[0] text = "\n".join(format_flavor_lines(ranked, picked)) assert "выберем" in text assert "4090-24" in text def test_cost_lines_mention_disk_and_killer(monkeypatch, tmp_path): monkeypatch.setenv("HOME", str(tmp_path)) monkeypatch.setenv("USERPROFILE", str(tmp_path)) monkeypatch.chdir(tmp_path) for key in ( "OS_AUTH_URL", "OS_USER_DOMAIN_NAME", "OS_USERNAME", "OS_PASSWORD", "OS_PROJECT_ID", "OS_REGION_NAME", "GPU_RENT_AZ", ): monkeypatch.delenv(key, raising=False) cfg = load_config(require_auth=False) lines = cost_and_risk_lines(cfg, spot=True, flavor_name="GPU 4090") blob = "\n".join(lines) assert "24/7" in blob assert "idle-killer" in blob assert "панель" in blob.lower() or "Selectel" in blob