Coverage for src/usls/application/_helpers.py: 100%
5 statements
« prev ^ index » next coverage.py v7.15.3, created at 2026-08-05 10:11 +0000
« prev ^ index » next coverage.py v7.15.3, created at 2026-08-05 10:11 +0000
1"""Internal helpers for USLSService — validation and input normalization.
3Extracted from service.py to keep that file focused on use-case orchestration.
4Schedule-strength analytics helpers live in ``_analytics_helpers.py``.
5"""
7_DATE_PATTERN_LENGTH = 8
10def _validate_yyyymmdd(value: str, label: str) -> str:
11 """Return ``value`` if it is exactly 8 digits, else raise ValueError citing ``label``."""
12 if not value.isdigit() or len(value) != _DATE_PATTERN_LENGTH:
13 raise ValueError(f"{label} must be in YYYYMMDD format, got {value!r}")
14 return value