c50367c6d5
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).
18 lines
645 B
Python
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."
|
|
)
|