https://protobuf.dev/programming-guides/proto3/#oneof
Oneof fields are like optional fields except all the fields in a oneof share memory, and at most one field can be set at the same time. Setting any member of the oneof automatically clears all the other members. You can check which value in a oneof is set (if any) using a special case() or WhichOneof() method, depending on your chosen language.
Note that if multiple values are set, the last set value as determined by the order in the proto will overwrite all previous ones.
this currently passes:
def test_multiple_oneof() -> None:
msg = OneofTest(
field_one=1,
field_two=2,
)
assert msg.field_one == 1
assert msg.field_two == 2
in the previous version (python-betterproto) it raised an AttributeError
https://protobuf.dev/programming-guides/proto3/#oneof
this currently passes:
in the previous version (python-betterproto) it raised an
AttributeError