Skip to content

Conversation

@chrispahm
Copy link

The current class-based enum definition yields invalid Python syntax when enums include whitespace

class EnumWithSpaces(str, Enum):
    another value = 'another value'
    some value = 'some value'

This PR changes the output of enums using the functional API that allows us to specify the member names using tuple lists or dicts. This way we can use names with spaces:

EnumWithSpaces = Enum(
    value='EnumWithSpaces',
    names=[
        ('another value', 'another value'),
        ('some value', 'some value')
    ]
)

All tests are passing and updated to the new enum syntax.

Fixes #68

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.

Whitespace in enums creates invalid syntax

1 participant