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

feat: Nested states (compound / parallel) and support for SCXML (test suit) #501

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from

Conversation

fgmacedo
Copy link
Owner

@fgmacedo fgmacedo commented Nov 22, 2024

Another approach for #329.

By supporting the test cases defined at https://www.w3.org/Voice/2013/scxml-irp/ we can incorporate small functionalities until we get covered by the full spec.

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 93.60269% with 114 lines in your changes missing coverage. Please review.

Project coverage is 96.21%. Comparing base (4449a9c) to head (93eaa58).

Files with missing lines Patch % Lines
statemachine/io/scxml/actions.py 92.12% 17 Missing and 9 partials ⚠️
statemachine/contrib/diagram.py 69.23% 11 Missing and 5 partials ⚠️
statemachine/io/scxml/parser.py 93.02% 7 Missing and 8 partials ⚠️
statemachine/engines/base.py 96.26% 5 Missing and 7 partials ⚠️
statemachine/orderedset.py 81.57% 7 Missing ⚠️
statemachine/engines/sync.py 92.30% 4 Missing and 1 partial ⚠️
statemachine/statemachine.py 92.75% 3 Missing and 2 partials ⚠️
statemachine/engines/async_.py 73.33% 3 Missing and 1 partial ⚠️
statemachine/factory.py 94.11% 2 Missing and 2 partials ⚠️
statemachine/io/scxml/processor.py 97.27% 0 Missing and 4 partials ⚠️
... and 9 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #501      +/-   ##
===========================================
- Coverage   100.00%   96.21%   -3.79%     
===========================================
  Files           25       31       +6     
  Lines         1631     3227    +1596     
  Branches       257      466     +209     
===========================================
+ Hits          1631     3105    +1474     
- Misses           0       71      +71     
- Partials         0       51      +51     
Flag Coverage Δ
unittests 96.21% <93.60%> (-3.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fgmacedo fgmacedo force-pushed the macedo/scxml branch 4 times, most recently from 5ce640e to 7efb429 Compare November 30, 2024 21:58
@fgmacedo fgmacedo changed the title feat: Basic support for SCXML test suit feat: Nested states (compound / parallel) and support for SCXML (test suit) Dec 14, 2024
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4 Security Hotspots

See analysis details on SonarQube Cloud

@comalice
Copy link
Contributor

comalice commented Jan 7, 2025

Is this in a state (🤣) that I could try it out? I have several use-cases where the sub-state functionality would be useful and I'd be glad to give feedback if I run into issues.

Note, the user experience I had expected looked something like this:

class SubMachine(StateMachine):
    test = State(initial=True)
    test_complete = State(final=True)

    next = test.to(test_complete)


class TestSM(StateMachine):
    initial_state = State(initial=True)
    sub_machine_as_state = SubMachine()
    some_other_state = State(final=True)

    goto_sub_machine = initial_state.to(sub_machine_as_state)
    goto_finish = sub_machine_as_state.to(some_other_state)

And then something like

sm = TestSM()

sm.send('goto_sub_machine')
sm.send('next')   # TestSM now has the submachine states as states it can traverse.
sm.send('goto_finish')

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

Successfully merging this pull request may close these issues.

2 participants