Add multi selecto to SelectionAction and SelectFileAction, Allow IOActions to receive no input, Rename subpackage falyx.parsers -> falyx.parser, Add default_text to UserInputAction

This commit is contained in:
2025-06-08 12:09:16 -04:00
parent b24079ea7e
commit 53ba6a896a
36 changed files with 373 additions and 80 deletions

View File

@ -38,13 +38,14 @@ async def test_action_async_callable():
action = Action("test_action", async_callable)
result = await action()
assert result == "Hello, World!"
print(action)
assert (
str(action)
== "Action(name='test_action', action=async_callable, args=(), kwargs={}, retry=False)"
== "Action(name='test_action', action=async_callable, retry=False, rollback=False)"
)
assert (
repr(action)
== "Action(name='test_action', action=async_callable, args=(), kwargs={}, retry=False)"
== "Action(name='test_action', action=async_callable, retry=False, rollback=False)"
)

View File

@ -50,9 +50,10 @@ def test_command_str():
"""Test if Command string representation is correct."""
action = Action("test_action", dummy_action)
cmd = Command(key="TEST", description="Test Command", action=action)
print(cmd)
assert (
str(cmd)
== "Command(key='TEST', description='Test Command' action='Action(name='test_action', action=dummy_action, args=(), kwargs={}, retry=False)')"
== "Command(key='TEST', description='Test Command' action='Action(name='test_action', action=dummy_action, retry=False, rollback=False)')"
)

View File

@ -1,7 +1,7 @@
import pytest
from falyx.exceptions import CommandArgumentError
from falyx.parsers import ArgumentAction, CommandArgumentParser
from falyx.parser import ArgumentAction, CommandArgumentParser
from falyx.signals import HelpSignal

View File

@ -2,7 +2,7 @@ import pytest
from falyx.action import Action, SelectionAction
from falyx.exceptions import CommandArgumentError
from falyx.parsers import ArgumentAction, CommandArgumentParser
from falyx.parser import ArgumentAction, CommandArgumentParser
def test_add_argument():

View File

@ -1,6 +1,6 @@
import pytest
from falyx.parsers import Argument, ArgumentAction
from falyx.parser import Argument, ArgumentAction
def test_positional_text_with_choices():

View File

@ -1,4 +1,4 @@
from falyx.parsers import ArgumentAction
from falyx.parser import ArgumentAction
def test_argument_action():

View File

@ -1,7 +1,7 @@
import pytest
from falyx.exceptions import CommandArgumentError
from falyx.parsers import CommandArgumentParser
from falyx.parser import CommandArgumentParser
def test_str():

View File

@ -5,7 +5,7 @@ from typing import Literal
import pytest
from falyx.parsers.utils import coerce_value
from falyx.parser.utils import coerce_value
# --- Tests ---

View File

@ -1,7 +1,7 @@
import pytest
from falyx.exceptions import CommandArgumentError
from falyx.parsers import ArgumentAction, CommandArgumentParser
from falyx.parser import ArgumentAction, CommandArgumentParser
@pytest.mark.asyncio

View File

@ -1,7 +1,7 @@
import pytest
from falyx.exceptions import CommandArgumentError
from falyx.parsers import ArgumentAction, CommandArgumentParser
from falyx.parser import ArgumentAction, CommandArgumentParser
@pytest.mark.asyncio