File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -741,15 +741,15 @@ def parse(self: T, data: bytes) -> T:
741
741
Parse the binary encoded Protobuf into this message instance. This
742
742
returns the instance itself and is therefore assignable and chainable.
743
743
"""
744
+ # Got some data over the wire
745
+ self ._serialized_on_wire = True
746
+
744
747
for parsed in parse_fields (data ):
745
748
field_name = self ._betterproto .field_name_by_number .get (parsed .number )
746
749
if not field_name :
747
750
self ._unknown_fields += parsed .raw
748
751
continue
749
752
750
- # Got some data over the wire
751
- self ._serialized_on_wire = True
752
-
753
753
meta = self ._betterproto .meta_by_field_name [field_name ]
754
754
755
755
value : Any
Original file line number Diff line number Diff line change @@ -39,11 +39,9 @@ class WithCollections(betterproto.Message):
39
39
2 , betterproto .TYPE_STRING , betterproto .TYPE_STRING
40
40
)
41
41
42
- # Unset with empty collections
42
+ # Is always set from parse, even if all collections are empty
43
43
with_collections_empty = WithCollections ().parse (bytes (WithCollections ()))
44
- assert betterproto .serialized_on_wire (with_collections_empty ) == False
45
-
46
- # Set with non-empty collections
44
+ assert betterproto .serialized_on_wire (with_collections_empty ) == True
47
45
with_collections_list = WithCollections ().parse (
48
46
bytes (WithCollections (test_list = ["a" , "b" , "c" ]))
49
47
)
You can’t perform that action at this time.
0 commit comments