Skip to main content
tests/test_clean_files.py · chapter Tests and team tooling, file 5 · 95 lines · open in the repository

What it does

The committed clean files (clean/*.parquet) must match their contracts and what config/ and common.study say should be in them. A file that is out of date, such as a retailer added to config/retailers.csv without re-running the ETL, fails here with the script to re-run.

What is inside

  • EDGE · line 24: Markets close for at most a few days in a row, so real data reaches this close to both ends of the study period; data from an older, shorter period does not.
  • REDOWNLOAD · line 25
  • read(dataset) · line 28

What it checks

  • clean file matches its contract (line 33)
  • prices cover the in scope retailers and the market index (line 38)
  • pageviews cover every in scope retailer on every day (line 48)
  • retail sales cover every series in every month (line 66)
  • master has one row per price row (line 75)
  • master labels exactly the calendar events on trading days (line 83)

Connections

Uses: src/common/contracts.py, src/common/settings.py, src/common/study.py

Source

tests/test_clean_files.py