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

Convert inited values to corresponding Enum members #115

Closed
wants to merge 1 commit into from

Conversation

Gobot1234
Copy link
Collaborator

Converts any values passed to their Enum counterparts.

@dataclasses.dataclass
class Test(betterproto.Message):
    attr: 'Enum' = betterproto.enum_field(1)

class Enum(betterproto.Enum):
    val = 1

>>> Test(attr=1)
Test(attr=<Enum.val: 1>)
# or
>>> Test().parse(b'\x08\x01')
Test(attr=<Enum.val: 1>)

@boukeversteegh
Copy link
Collaborator

boukeversteegh commented Jul 12, 2020

Hi Godot, thank you for your improvement, but this change is already included in Pr #102.

@Gobot1234
Copy link
Collaborator Author

Ok then.

@Gobot1234 Gobot1234 closed this Jul 12, 2020
@Gobot1234 Gobot1234 deleted the enum-values branch July 12, 2020 13:40
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