# Tests Pure-Python unit + property tests for the algorithm layer. These tests do **not** import SGLang and do **not** need a GPU — they validate the routing algorithm (Algorithm 1/2/3 in `docs/KVC_ROUTER_ALGORITHM.md`) and its theorems against the pure functions extracted from `policies.py`. ## Run ```bash uv sync --group test uv run pytest ``` Or, without uv: ```bash pip install pytest PYTHONPATH=src pytest tests ``` ## Scope - `test_policy_scoring.py` — Algorithm 1 lex-score properties (overlap dominates sticky, load-floor gating, tie-breakers). - `test_no_starvation.py` — Theorem 1: bounded retries before some D either accepts or the least-rejected D is forced through the degenerate path. Future: - block-level eviction `MockRadixCache` tests (see `docs/BLOCK_LEVEL_EVICTION_DESIGN_ZH.md` §5). - D→P sync `staleness_budget` property tests (see `docs/D_TO_P_SYNC_CONTRACT_ZH.md` §1). ## Why no integration tests here Anything that needs SGLang, mooncake, or a real model is an integration test and must run on hardware. Those tests live as `scripts/sweep_*.sh` under the evaluation protocol in `docs/EVALUATION_PROTOCOL_ZH.md`.