Skip to main content
tests/test_compare.py · chapter Tests and team tooling, file 9 · 112 lines · open in the repository

What it does

Tests for streaming.compare, the streaming vs batch comparison (task #9).

What is inside

  • TRADING_DAYS · line 11: made-up calendar, weekdays only
  • windows(n, day0, tickers) · line 14: n made-up event windows that follow the stream_event_car contract.
  • day_plus_5(day0) · line 30

What it checks

  • the two contracts have the same columns (line 34)
  • identical tables match (line 39)
  • rounding error is not a difference (line 46)
  • a real difference fails and is counted (line 52)
  • missing on both sides counts as equal (line 63)
  • a window still open in the stream is not a failure (line 67)
  • a truncated stream fails (line 79)
  • an empty stream fails (line 86)
  • without a stream end nothing counts as open (line 93)
  • a window only in the stream fails (line 97)
  • repeated keys fail (line 102)
  • a flipped significance call is reported (line 108)

Connections

Uses: src/common/contracts.py, src/common/study.py, src/streaming/compare.py

Source

tests/test_compare.py