Skip to content

test: pin _cut - one line for a short field, its own lines for a body - #77

Open
gsneto wants to merge 1 commit into
ldbumble:masterfrom
gsneto:test/lookups-cut
Open

gsneto wants to merge 1 commit into
ldbumble:masterfrom
gsneto:test/lookups-cut

Conversation

@gsneto

@gsneto gsneto commented Sep 26, 2026

Copy link
Copy Markdown

Closes #73.

What changed

A new CutTests class in tests/test_lookups.py pins lookups._cut.

Why

_cut trims every look-up's text before the assistant reads it. It is pure, used everywhere, and had no test of its own.

How

Six cases, covering the behaviour the issue names:

  • a short field (n < 600) collapses whitespace and newlines to single spaces;
  • a body (n >= 600) keeps its own lines;
  • the boundary itself: 599 collapses, 600 keeps;
  • a string exactly n long is not cut;
  • a longer one ends with […];
  • None reads as ''.

Tests

python -m pytest tests/test_lookups.py::CutTests -q
6 passed in 3.02s

python -m pytest -q
5370 passed, 8 skipped in 337.64s

Windows 11, Python 3.12.10.

No code change - the guard is the point.

lookups._cut trims every read's text before the assistant sees it and had no test of its own. CutTests pins what it does: whitespace and newlines collapse below 600, a body keeps its lines at 600, a string exactly n long is not cut, a longer one ends with ' [...]', and None reads as ''.

No behaviour change - the guard is the point (issue ldbumble#73).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for lookups._cut

1 participant