Test to_dict with missing enum values
This commit is contained in:
parent
a46979c8a6
commit
c48ca2e386
@ -13,6 +13,7 @@ tests = {
|
|||||||
"namespace_builtin_types", # 53
|
"namespace_builtin_types", # 53
|
||||||
"googletypes_struct", # 9
|
"googletypes_struct", # 9
|
||||||
"googletypes_value", # 9
|
"googletypes_value", # 9
|
||||||
|
"to_dict_with_missing_enum", # 93
|
||||||
}
|
}
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
from betterproto.tests.output_betterproto.to_dict_with_missing_enum.to_dict_with_missing_enum import TestMessage
|
||||||
|
|
||||||
|
|
||||||
|
def test_message_attributes():
|
||||||
|
assert TestMessage(x=TestMessage.MyEnum.ONE).to_dict()['x'] == "ONE", "MyEnum.ONE is not serialized to 'ONE'"
|
||||||
|
assert TestMessage(x=TestMessage.MyEnum.THREE).to_dict()['x'] == "THREE", "MyEnum.THREE is not serialized to 'THREE'"
|
||||||
|
assert TestMessage(x=TestMessage.MyEnum.FOUR).to_dict()['x'] == "FOUR", "MyEnum.FOUR is not serialized to 'FOUR'"
|
@ -0,0 +1,12 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
message TestMessage {
|
||||||
|
enum MyEnum {
|
||||||
|
ZERO = 0;
|
||||||
|
ONE = 1;
|
||||||
|
// TWO = 2;
|
||||||
|
THREE = 3;
|
||||||
|
FOUR = 4;
|
||||||
|
}
|
||||||
|
MyEnum x = 1;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user