pytransitions / transitions

A lightweight, object-oriented finite state machine implementation in Python with many extensions
MIT License
5.68k stars 530 forks source link

Fix resolving enums when they are set as nested initial states #506

Closed thedrow closed 3 years ago

thedrow commented 3 years ago

If we set a nested state's initial value to an enum it doesn't get resolved and raises a KeyError instead. I'm not sure which test case reproduces this directly though so I'd appriciate if you can write a unit test for this.

aleneum commented 3 years ago

Travis is unfortunately overloaded (again) but the change looks good to me. Thanks!

thedrow commented 3 years ago

How can we write a test for this? It only reproduces with deeply nested states as far as I can see.

aleneum commented 3 years ago

I assume that something like this can be rewritten to use Enums instead.