feat: Add module docs, Enum coercion, tracebacks, and toggle improvements
- Add comprehensive module docstrings across the codebase for better clarity and documentation. - Refactor Enum classes (e.g., FileType, ConfirmType) to use `_missing_` for built-in coercion from strings. - Add `encoding` attribute to `LoadFileAction`, `SaveFileAction`, and `SelectFileAction` for more flexible file handling. - Enable lazy file loading by default in `SelectFileAction` to improve performance. - Simplify bottom bar toggle behavior: all toggles now use `ctrl+<key>`, eliminating the need for key conflict checks with Falyx commands. - Add `ignore_in_history` attribute to `Command` to refine how `ExecutionRegistry` identifies the last valid result. - Improve History command output: now includes tracebacks when displaying exceptions.
This commit is contained in:
94
tests/test_actions/test_confirm_action.py
Normal file
94
tests/test_actions/test_confirm_action.py
Normal file
@ -0,0 +1,94 @@
|
||||
import pytest
|
||||
|
||||
from falyx.action import ConfirmAction
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_yes_no():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="yes_no",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_yes_cancel():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="yes_cancel",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_yes_no_cancel():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="yes_no_cancel",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_type_word():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="type_word",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_type_word_cancel():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="type_word_cancel",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_ok_cancel():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="ok_cancel",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_confirm_action_acknowledge():
|
||||
action = ConfirmAction(
|
||||
name="test",
|
||||
message="Are you sure?",
|
||||
never_prompt=True,
|
||||
confirm_type="acknowledge",
|
||||
)
|
||||
|
||||
result = await action()
|
||||
assert result is True
|
@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from falyx.action.selection_action import SelectionAction
|
||||
from falyx.action import SelectionAction
|
||||
from falyx.selection import SelectionOption
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user