Skip to content

Commit

Permalink
pw_protobuf_compiler: Nested oneof messages in repr
Browse files Browse the repository at this point in the history
Cover nested messages in a oneof in the proto_repr() tests.

Change-Id: I6b687eb389cc7b6850209d99f8ff952b3dc0feae
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/96006
Reviewed-by: Alexei Frolov <frolv@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
  • Loading branch information
255 authored and CQ Bot Account committed Jun 6, 2022
1 parent 0188395 commit cb087eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pw_protobuf_compiler/py/python_protos_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def test_messages(self):
oneof oneof_test {
string oneof_1 = 15;
int32 oneof_2 = 16;
float oneof_3 = 17;
Nested oneof_3 = 17;
}
map<string, Nested> mapping = 18;
Expand Down Expand Up @@ -363,8 +363,11 @@ def test_oneof(self):
"pw.test3.Message(oneof_1='test')")
self.assertEqual(proto_repr(self.message(oneof_2=123)),
"pw.test3.Message(oneof_2=123)")
self.assertEqual(proto_repr(self.message(oneof_3=123)),
"pw.test3.Message(oneof_3=123.0)")
self.assertEqual(
proto_repr(
self.message(oneof_3=self.nested(an_enum=self.enum.ONE))),
'pw.test3.Message('
'oneof_3=pw.test3.Nested(an_enum=pw.test3.Enum.ONE))')

msg = self.message(oneof_1='test')
msg.oneof_2 = 99
Expand Down

0 comments on commit cb087eb

Please sign in to comment.