3 changed files with 32 additions and 1 deletions
+2 -1
View File
@@ -6,7 +6,8 @@ xfail = {
"namespace_keywords", # 70 "namespace_keywords", # 70
"namespace_builtin_types", # 53 "namespace_builtin_types", # 53
"googletypes_struct", # 9 "googletypes_struct", # 9
"googletypes_value", # 9, "googletypes_value", # 9
"enum_skipped_value", # 93
"import_capitalized_package", "import_capitalized_package",
"example", # This is the example in the readme. Not a test. "example", # This is the example in the readme. Not a test.
} }
@@ -0,0 +1,12 @@
syntax = "proto3";
message Test {
enum MyEnum {
ZERO = 0;
ONE = 1;
// TWO = 2;
THREE = 3;
FOUR = 4;
}
MyEnum x = 1;
}
@@ -0,0 +1,18 @@
from betterproto.tests.output_betterproto.enum_skipped_value import (
Test,
TestMyEnum,
)
import pytest
@pytest.mark.xfail(reason="#93")
def test_message_attributes():
assert (
Test(x=TestMyEnum.ONE).to_dict()["x"] == "ONE"
), "MyEnum.ONE is not serialized to 'ONE'"
assert (
Test(x=TestMyEnum.THREE).to_dict()["x"] == "THREE"
), "MyEnum.THREE is not serialized to 'THREE'"
assert (
Test(x=TestMyEnum.FOUR).to_dict()["x"] == "FOUR"
), "MyEnum.FOUR is not serialized to 'FOUR'"