# backend/tests

Golden-file tests that pin the behavior of the **pure calculation core** — the functions
that decide what stock status, coverage, and weeks-of-cover a SKU gets. They take plain
arguments (no DB, no fixtures), so the suite runs anywhere.

The point is **safety for refactoring**: before changing any of these functions (e.g.
unifying the three coverage classifiers), run the suite to prove the numbers didn't move
unintentionally.

## Run

```
python -m pytest backend/tests -q
```

(On this machine the interpreter is
`C:\Users\Korisnik\AppData\Local\Programs\Python\Python312\python.exe`.)

## What's covered

| File | Function(s) under test | Why it matters |
|---|---|---|
| `test_coverage_classifier.py` | `classify_coverage`, `incoming_within_lt` | The canonical LT-relative inventory-health rule. Every page should eventually agree with this. |
| `test_supply_roll_forward.py` | `_roll_forward`, `_classify`, `_safe_float` | The 13-week stock projection core (now shared by 3 supply views) + the abs-weeks status thresholds. |
| `test_scenario_service.py` | `week_step`, `week_series`, `real_weeks_cover`, `classify` | Supplier scenario math (cancel/postpone/produce) — feeds supplier-facing output. |
| `test_time_utils.py` | `iso_week_first_monday`, `split_iso_week_across_months`, `days_in_calendar_month` | Week→month splitting; a wrong split silently misallocates revenue between months. |
