Files
falyx/tests/test_execution_option.py
Roland Thomas 30cb8b97b5 feat: add recursive namespace routing and standalone runner polish
- introduce namespace-aware routing with RootParseResult, RouteResult, and InvocationContext
- register submenus as FalyxNamespace entries and resolve them through _entry_map
- refactor FalyxParser to parse only root options and leave recursive routing to Falyx
- add prepare_route, resolve_route, and route dispatch flow to Falyx
- update validator and completer to understand namespace entries and route results
- unify help/TLDR rendering APIs and add custom_tldr support on Command
- tighten Command.resolve_args error handling and parser type validation
- improve CommandRunner dependency validation and argv handling
- add BottomBar.has_items and improve wrapped executor error messages
- add tests for execution options, resolve_args, command runner, and route-aware validation
2026-04-11 11:57:03 -04:00

31 lines
1.0 KiB
Python

import pytest
from falyx.execution_option import ExecutionOption
def test_execution_option_accepts_valid_string_values():
assert ExecutionOption("summary") == ExecutionOption.SUMMARY
assert ExecutionOption("retry") == ExecutionOption.RETRY
assert ExecutionOption("confirm") == ExecutionOption.CONFIRM
def test_execution_option_rejects_invalid_string():
with pytest.raises(ValueError, match="Invalid ExecutionOption: 'invalid'"):
ExecutionOption("invalid")
def test_execution_option_normalizes_case_and_whitespace():
assert ExecutionOption(" SUMMARY ") == ExecutionOption.SUMMARY
assert ExecutionOption("ReTrY") == ExecutionOption.RETRY
assert ExecutionOption("\tconfirm\n") == ExecutionOption.CONFIRM
def test_execution_option_rejects_non_string():
with pytest.raises(ValueError, match="Invalid ExecutionOption: 123"):
ExecutionOption(123)
def test_execution_option_error_lists_valid_values():
with pytest.raises(ValueError, match="Must be one of: summary, retry, confirm"):
ExecutionOption("invalid")