tests/test_event_calendar.py · chapter Tests and team tooling, file 3 · 86 lines · open in the repository
What it does
The event calendar (config/event_types.csv and config/event_dates.csv) must follow its contract, so anyone can add an event by adding a row without breaking the pipeline.What is inside
What it checks
- config files have the contract columns in order (line 31)
- event types are unique snake case ids (line 36)
- every date rule is valid (line 44)
- offset rules point at known events (line 49)
- in scope is yes or no (line 57)
- in scope only filter (line 61)
- listed dates belong to listed events and have sources (line 66)
- in scope listed events have one date per study year (line 74)
Connections
Uses:src/common/contracts.py, src/common/study.py
Source
tests/test_event_calendar.py