test_source_caps_and_flags_truncation¶
Tests › tests/test_query.py
What this test is for
Why it exists
A comparison query layer shipped an UNBOUNDED source tool and one call returned 26 KB, distorting its own token accounting. The cap is the fix, so it is asserted: at most max_lines, truncated=True, and the reported end_line describes exactly what came back.
Verifies REQ-DDB-QUERY-002
Given
- —
When
full = q.source(rich_db, "sensor_poll", repo_root)capped = q.source(rich_db, "sensor_poll", repo_root, max_lines=2)
Then
- ✓ full is not None
- ✓ len(full.lines) is greater than 2
- ✓ capped is not None
- ✓ len(capped.lines) equals 2
- ✓ capped.truncated is True
- ✓ capped.start_line equals full.start_line
- ✓ capped.end_line equals full.start_line + 1
- ✓ capped.lines equals full.lines[:2]
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
Look up one name: everything the index holds about it · 7 of 226 steps
… 17 earlier steps
… 23 steps between
… 24 steps between
… 143 later steps
3 more
- Build this wiki from the index · 4 of 400 steps
- clew — `main` (clew/cli.py) · 3 of 400 steps
- `main` (scripts/export_parity.py) · 3 of 203 steps
tests/test_query.py:713 · its file's page
What it checks (7)
assert full is not None and len(full.lines) > 2observessourceviafullassert capped is not Noneobservessourceviacappedassert len(capped.lines) == 2observessourceviacappedassert capped.truncated is Trueobservessourceviacappedassert capped.start_line == full.start_lineobservessourceviacappedassert capped.end_line == full.start_line + 1observessourceviacappedassert capped.lines == full.lines[:2]observessourceviacapped
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-QUERY-002 | catalog | unknown |
Also reaches 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-004 measured
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-010 measured