RICS / backend /tests /test_no_rics_hardcodes.py
StormShadow308's picture
Add demo documentation and Docker setup for v2 report generation system
aad7814
Raw
History Blame Contribute Delete
700 Bytes
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}"