mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
test(ci): annotate new test locals as Final
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9850cd14f7
commit
bbfa853d84
2 changed files with 9 additions and 8 deletions
|
|
@ -9,6 +9,7 @@ import importlib.util
|
|||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
_MODULE_PATH = (
|
||||
Path(__file__).resolve().parents[2] / "scripts" / "budget_ratchet_check.py"
|
||||
|
|
@ -93,31 +94,31 @@ def test_graduation_never_excuses_a_raised_limit():
|
|||
|
||||
|
||||
def test_dropped_rule_the_checker_retired_is_clean():
|
||||
base = {"TQ008": _spec_of(10993)}
|
||||
base: Final = {"TQ008": _spec_of(10993)}
|
||||
assert ratchet.regressions_for("b.json", base, {}, retired=frozenset({"TQ008"})) == []
|
||||
|
||||
|
||||
def test_dropped_rule_the_checker_still_emits_is_a_regression():
|
||||
base = {"TQ001": _spec_of(5), "TQ008": _spec_of(10993)}
|
||||
regs = ratchet.regressions_for("b.json", base, {}, retired=frozenset({"TQ008"}))
|
||||
base: Final = {"TQ001": _spec_of(5), "TQ008": _spec_of(10993)}
|
||||
regs: Final = ratchet.regressions_for("b.json", base, {}, retired=frozenset({"TQ008"}))
|
||||
assert [r.rule for r in regs] == ["TQ001"]
|
||||
assert "dropped" in regs[0].detail
|
||||
|
||||
|
||||
def test_retirement_never_excuses_a_raised_limit():
|
||||
base = {"TQ008": _spec_of(0)}
|
||||
regs = ratchet.regressions_for("b.json", base, {"TQ008": _spec_of(7)}, retired=frozenset({"TQ008"}))
|
||||
base: Final = {"TQ008": _spec_of(0)}
|
||||
regs: Final = ratchet.regressions_for("b.json", base, {"TQ008": _spec_of(7)}, retired=frozenset({"TQ008"}))
|
||||
assert [r.rule for r in regs] == ["TQ008"]
|
||||
assert "0 -> 7" in regs[0].detail
|
||||
|
||||
|
||||
def test_retired_rules_come_from_the_paired_checker():
|
||||
base = {"TQ001": _spec_of(5), "TQ008": _spec_of(10993)}
|
||||
base: Final = {"TQ001": _spec_of(5), "TQ008": _spec_of(10993)}
|
||||
assert ratchet.retired_rules("test-quality-budget.json", base) == frozenset({"TQ008"})
|
||||
|
||||
|
||||
def test_budgets_without_a_paired_checker_never_retire():
|
||||
base = {"TQ008": _spec_of(1)}
|
||||
base: Final = {"TQ008": _spec_of(1)}
|
||||
for rel in ("ruff-strict-budget.json", "type-discipline-budget.json", "basedpyright-code-budget.json"):
|
||||
assert ratchet.retired_rules(rel, base) == frozenset()
|
||||
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ _VIOLATING_SNIPPETS: Final = MappingProxyType(
|
|||
|
||||
|
||||
def test_rule_codes_match_every_code_the_checker_emits(tmp_path):
|
||||
emitted = frozenset(
|
||||
emitted: Final = frozenset(
|
||||
v.code
|
||||
for name, source in _VIOLATING_SNIPPETS.values()
|
||||
for v in checker.check_file(_written(tmp_path, source, name))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue