Download tests/tui_gateway/test_command_description_fidelity.py from SaylorTwift/hermes-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/SaylorTwift/hermes-agent/resolve/main/tests/tui_gateway/test_command_description_fidelity.py
- Command line
-
hf download hf://SaylorTwift/hermes-agent/tests/tui_gateway/test_command_description_fidelity.py
-
curl -L -o test_command_description_fidelity.py https://huggingface.co/SaylorTwift/hermes-agent/resolve/main/tests/tui_gateway/test_command_description_fidelity.py
1.4 kB
| """Command descriptions survive both catalog and completion transport.""" | |
| from prompt_toolkit.completion import CompleteEvent | |
| from prompt_toolkit.document import Document | |
| def test_full_descriptions_survive_catalog_and_completion(monkeypatch): | |
| from agent import skill_commands | |
| from hermes_cli import plugins | |
| from hermes_cli.commands_completion import SlashCommandCompleter | |
| from tui_gateway import server | |
| description = "Read the entire description before selecting a command. " * 8 | |
| skills = {"/proof-skill": {"name": "proof-skill", "description": description}} | |
| monkeypatch.setattr(skill_commands, "scan_skill_commands", lambda: skills) | |
| monkeypatch.setattr(plugins, "get_plugin_commands", lambda: {"proof-plugin": {"description": description}}) | |
| monkeypatch.setattr(server, "_load_cfg", lambda: {"quick_commands": {"proof-quick": {"description": description}}}) | |
| catalog = server._methods["commands.catalog"](1, {})["result"] | |
| pairs = dict(catalog["pairs"]) | |
| for name in ("/proof-skill", "/proof-plugin", "/proof-quick"): | |
| assert pairs[name] == description | |
| completer = SlashCommandCompleter(skill_commands_provider=lambda: skills) | |
| completions = list(completer.get_completions(Document("/proof"), CompleteEvent())) | |
| assert len(completions) == 2 | |
| assert all(description in completion.display_meta_text for completion in completions) | |