- 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.
95 lines
1.9 KiB
Python
95 lines
1.9 KiB
Python
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
|