Private
Public Access
0
0
Files
manual_slop/tests/test_discussion_truncate_layout.py
ed f663a34f52 test(discussion_truncate): use rfind() to locate code (Phase 5.1, fixes 1 pre-existing failure)
The test used src.find() which locates the first occurrence of
'Keep Pairs:' in the comment block (line 5113 in src/gui_2.py), not
the actual code (line 5130). The 200-char snippet window only reaches
the comment, so the assertions for set_next_item_width(140) and
drag_int fail.

Production code is already correct (set_next_item_width(140) +
drag_int) at src/gui_2.py:5130-5131 (user commit d0b06575). This
test just needs to use rfind() to locate the actual code, not the
comment.

Change: src.find(marker) -> src.rfind(marker)

1 test passes (was 1 pre-existing failure).
2026-06-15 18:21:58 -04:00

19 lines
604 B
Python

import inspect
from src import gui_2
def test_keep_pairs_input_uses_adequate_width():
src = inspect.getsource(gui_2)
marker = "Keep Pairs:"
idx = src.rfind(marker)
assert idx != -1, "Could not find Keep Pairs label in gui_2.py"
snippet = src[idx:idx + 200]
assert "set_next_item_width(80)" not in snippet, (
"Keep Pairs input width is still 80px; digit values get clipped."
)
assert "set_next_item_width(140)" in snippet, (
"Keep Pairs input should use width 140 for 2-3 digit values."
)
assert "drag_int" in snippet, (
"Keep Pairs input should use drag_int for inline +/- controls."
)