Skip to content

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