Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: The dynamic dispatcher is not filling default values for parameters on callbacks. #341

Closed
fgmacedo opened this issue Jan 28, 2023 · 0 comments
Assignees
Labels

Comments

@fgmacedo
Copy link
Owner

fgmacedo commented Jan 28, 2023

  • Python State Machine version: 1.0.3
  • Python version: 3.11
  • Operating System: Any

Description

The dynamic dispatcher is not filling default values for parameters on callbacks.

from statemachine import State
from statemachine import StateMachine


class XMachine(StateMachine):
    initial = State(initial=True, enter="enter_with_default_value")

    test = initial.to.itself()

    def enter_with_default_value(self, value: int = 42):
        assert value == 42, value

XMachine()

Raises:

    assert value == 42, value
           ^^^^^^^^^^^
AssertionError: None

Development notes: Migrate dispatcher.py to inspect.signature that has a nicer API instead of the currently inspect.getfullargspec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant