Spaces:
Runtime error
Runtime error
File size: 700 Bytes
aad7814 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | from __future__ import annotations
import re
from pathlib import Path
import pytest
_BACKEND_ROOT = Path(__file__).resolve().parents[1]
_FORBIDDEN = re.compile(
r"Condition Rating|CR[123]|_RICS_LETTER",
re.IGNORECASE,
)
@pytest.mark.parametrize(
"path",
[
p
for p in _BACKEND_ROOT.rglob("*.py")
if "tests" not in p.parts
and "prompts" not in p.parts
and p.name != "rics_canonical_l3.py"
and p.name != "__init__.py"
],
)
def test_no_rics_hardcodes_in_production(path: Path):
text = path.read_text(encoding="utf-8")
matches = _FORBIDDEN.findall(text)
assert not matches, f"{path}: forbidden RICS constants {matches}"
|