Enforce serialize_empty for repeated fields (#417)

This commit is contained in:
sterliakov
2022-08-31 21:59:12 +04:00
committed by GitHub
parent 8fbf4476a8
commit bfc0fac754
5 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
syntax = "proto3";
package regression_387;
message Test {
uint64 id = 1;
}
message ParentElement {
string name = 1;
repeated Test elems = 2;
}

View File

@@ -0,0 +1,12 @@
from tests.output_betterproto.regression_387 import (
ParentElement,
Test,
)
def test_regression_387():
el = ParentElement(name="test", elems=[Test(id=0), Test(id=42)])
binary = bytes(el)
decoded = ParentElement().parse(binary)
assert decoded == el
assert decoded.elems == [Test(id=0), Test(id=42)]