fix(acms): satisfy architecture dataclass check and ruff format

- Use @dataclass(slots=True) on BudgetViolation, ContextFile, BudgetEnforcer
  so the features/architecture.feature "Type hints are used throughout"
  scenario passes (the AST check only flags bare @dataclass decorators,
  consistent with the project-wide convention used elsewhere in src/).
- Re-format features/steps/acms_budget_enforcement_steps.py and
  robot/helper_acms_budget_enforcement.py via ruff format to clear the
  lint gate's ruff format --check failure.

ISSUES CLOSED: #9583
This commit is contained in:
2026-06-03 12:38:54 -04:00
committed by drew
parent 9325a75403
commit de65e4408a
3 changed files with 23 additions and 63 deletions
+4 -12
View File
@@ -63,9 +63,7 @@ def _test_total_size_cutoff() -> None:
f"Expected total size 2000, got {enforcer.get_total_size()}"
)
violations = enforcer.get_violations()
total_violations = [
v for v in violations if v.violation_type == "max_total_size"
]
total_violations = [v for v in violations if v.violation_type == "max_total_size"]
assert len(total_violations) == 1, (
f"Expected 1 max_total_size violation, got {len(total_violations)}"
)
@@ -118,17 +116,13 @@ def _test_constructor_validation() -> None:
BudgetEnforcer(max_file_size=-1, max_total_size=5000)
raise AssertionError("Expected ValueError for negative max_file_size")
except ValueError as e:
assert "max_file_size" in str(e), (
f"Error should mention max_file_size: {e}"
)
assert "max_file_size" in str(e), f"Error should mention max_file_size: {e}"
try:
BudgetEnforcer(max_file_size=100, max_total_size=0)
raise AssertionError("Expected ValueError for zero max_total_size")
except ValueError as e:
assert "max_total_size" in str(e), (
f"Error should mention max_total_size: {e}"
)
assert "max_total_size" in str(e), f"Error should mention max_total_size: {e}"
try:
BudgetEnforcer(max_file_size=5000, max_total_size=1000)
@@ -188,9 +182,7 @@ def _test_multibyte_utf8() -> None:
content_boundary = emoji_char * 250
assert len(content_boundary.encode("utf-8")) == 1000
included2 = enforcer2.add_file("boundary.txt", content_boundary)
assert included2 is True, (
"File with exactly 1000 bytes should be included"
)
assert included2 is True, "File with exactly 1000 bytes should be included"
print("multibyte-utf8-ok")