From f663a34f52378a2030542884edf56e00cb8686f8 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 18:21:58 -0400 Subject: [PATCH] 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). --- tests/test_discussion_truncate_layout.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_discussion_truncate_layout.py b/tests/test_discussion_truncate_layout.py index 223b55e6..4417cff0 100644 --- a/tests/test_discussion_truncate_layout.py +++ b/tests/test_discussion_truncate_layout.py @@ -4,7 +4,7 @@ from src import gui_2 def test_keep_pairs_input_uses_adequate_width(): src = inspect.getsource(gui_2) marker = "Keep Pairs:" - idx = src.find(marker) + 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, (