Files
odysseus/tests/test_web_search_tool_not_clickable_static.py
T
64b457dc0a fix(tests): read static sources as UTF-8 in the static assertion tests (#6850)
On native Windows the default text encoding is the ANSI code page
(cp1252 on en/pt systems), so the module-level read_text() calls in
eight static tests fail at collection with UnicodeDecodeError on bytes
0x81/0x90 that appear in static/js/chat.js, chatRenderer.js, app.js,
index.html and src/visual_report.py. Pass encoding="utf-8" like the
other 700+ tests in the suite already do.

Found by running the suite natively on Windows 11 (Python 3.11).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Alexandre Teixeira <general@alexandreteixeira.dev>
2026-11-01 01:26:11 +00:00

23 lines
946 B
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
RENDERER = (ROOT / "static/js/chatRenderer.js").read_text(encoding="utf-8")
CHAT = (ROOT / "static/js/chat.js").read_text(encoding="utf-8")
def test_saved_web_search_tool_icon_has_no_action_target():
start = RENDERER.index("export function getToolActionTarget")
block = RENDERER[start:RENDERER.index("if (lower === 'web_fetch'", start)]
assert "return null;" in block
assert "Open search results" not in block
def test_saved_and_live_web_search_queries_are_plain_text():
for source in (RENDERER, CHAT):
start = source.index("if (lower === 'web_search'", source.index("function _toolDisplayInfo"))
block = source[start:source.index("if (lower === 'web_fetch'", start)]
assert '<span class="agent-thread-summary">' in block
assert "agent-thread-summary-link" not in block
assert "Open search results" not in block