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

Add support for StrEnum #373

Closed
wants to merge 3 commits into from

Conversation

chrisjbremner
Copy link

Enum allows you to subclass it with additional mixins to create custom Enums that act in a similar fashion to what you are mixing in. For example, you can create an IntEnum which allows the enum to be used like an int. Similarly, you can make a StrEnum to do string comparisons.

Using a StrEnum almost works with the existing code base, but there's one small if statement that incorrectly catches StrEnums but not regular Enums, which I fix in this PR. I also included a test that would fail without this code change, but succeeds after.

@coveralls
Copy link

coveralls commented Oct 21, 2019

Coverage Status

Coverage decreased (-0.2%) to 98.333% when pulling c4dae18 on chrisjbremner:master into 02076d3 on pytransitions:master.

@chrisjbremner
Copy link
Author

@aleneum I also found that the diagramming extensions did not work when using Enums for states (because it sometimes referred to each state by the Enum's name, and other times by just the Enum itself), so I attempted to fix that as well in my most recent commit.

@chrisjbremner
Copy link
Author

Looks like my second commit broke some tests, I will fix that when I get a chance.

@chrisjbremner
Copy link
Author

Closing, as this was fixed in #357

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.

None yet

2 participants