Skip to main content
tests/test_contracts.py · chapter Tests and team tooling, file 1 · 88 lines · open in the repository

What it does

The written contracts (docs/data-contracts.md) and the code (src/common/contracts.py) must always describe the same schemas. If one changes without the other, these tests fail.

What is inside

What it checks

  • docs and code define the same datasets (line 31)
  • docs and code agree column by column (line 35)
  • only known types are used (line 44)
  • check columns accepts an exact match (line 50)
  • check columns reports missing wrong and extra columns (line 54)
  • require contract raises with every problem (line 62)
  • pandas columns reads types as parquet will store them (line 67)
  • parquet columns reads a spark style folder as stored (line 80)

Connections

Uses: src/common/contracts.py

Source

tests/test_contracts.py