test: cover help_md keys, header smoke, and bilingual ES smoke

Two stale Spanish smoke assertions still expected English page titles
for PDF Extractor and Reconciler — the i18n work landed real
translations ("PDF a CSV", "Reconciliar dos archivos"), so refresh the
expected substrings and the surrounding comment.

Add new coverage for the help-popover feature:
- TestHelpPopoverKeys (test_lang_packs): every tool_id resolves a
  non-empty tools.<id>.help_md in BOTH packs; help.button_label and
  help.missing_body resolve in both.
- TestDescriptionCopy (test_tools_registry): every Tool.description
  non-empty and under 120 chars — pins the post-jargon-scrub copy
  so future drift back into multi-clause prose is loud.
- TestRenderToolHeaderSmoke: render_tool_header is callable, listed
  in components.__all__, and every i18n key it touches resolves in
  both packs. Runs without a Streamlit script context.

Suite: 2427 passed (+9 new), 91 skipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 18:07:02 +00:00
parent 4a8961d58a
commit 4955fb239b
3 changed files with 106 additions and 6 deletions

View File

@@ -178,3 +178,32 @@ class TestKeyCoverage:
for lang in ("en", "es"):
value = t(key, lang)
assert value and value != key, f"missing {key!r} in {lang}"
class TestHelpPopoverKeys:
"""Every tool's inline Help popover (``render_tool_header``) pulls
its copy from ``tools.<id>.help_md`` and the two shared labels
``help.button_label`` / ``help.missing_body``. A missing key would
fall back to the literal lookup key and render that string in the
popover instead of helpful content."""
@pytest.mark.parametrize("lang", ["en", "es"])
def test_help_shared_keys_present(self, lang):
for key in ("help.button_label", "help.missing_body"):
value = t(key, lang)
assert value and value != key, f"missing {key!r} in {lang!r}"
@pytest.mark.parametrize("lang", ["en", "es"])
def test_every_tool_has_help_md(self, lang):
# Import lazily so this file stays importable without the GUI.
from src.gui.tools_registry import TOOLS
missing: list[str] = []
for tool in TOOLS:
key = f"tools.{tool.tool_id}.help_md"
value = t(key, lang)
if not value or value == key or not value.strip():
missing.append(tool.tool_id)
assert not missing, (
f"language {lang!r} is missing help_md for: {missing}"
)