Private
Public Access
0
0
Files
manual_slop/tests/test_log_management_refresh.py
T
ed c50367c6d5 test(log_management_refresh): use rfind() to locate code (Phase 5.2, fixes 1 pre-existing failure)
The test used src.find() which locates the first occurrence of
'Refresh Registry' in the comment block (line 2090 in src/gui_2.py),
not the actual code (line 2111). The 400-char snippet window doesn't
reach the code, so the assertion for 'load_registry' fails.

Production code is already correct (in-place load_registry()) at
src/gui_2.py:2111-2112 (user commit df7bda6e). 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:27:40 -04:00

18 lines
645 B
Python

import inspect
from src import gui_2
def test_refresh_registry_button_calls_load_registry():
src = inspect.getsource(gui_2)
marker = "Refresh Registry"
idx = src.rfind(marker)
assert idx != -1, "Could not find Refresh Registry button in gui_2.py"
snippet = src[idx:idx + 400]
assert "load_registry" in snippet, (
"Refresh Registry button must invoke load_registry(); "
"currently it only re-instantiates LogRegistry which leaves .data empty."
)
assert snippet.count("log_registry.LogRegistry(") <= 1, (
"Refresh Registry button should not re-instantiate LogRegistry. "
"Prefer in-place load_registry() on the live instance."
)