Ysh*_*Ysh 5 python unit-testing protocol-buffers
我有一条 google protobuf 消息:
message Foo {
required int bar = 1;
}
Run Code Online (Sandbox Code Playgroud)
我知道为了测试消息的字段,我们可以使用:
foo.bar = 1
assert foo.HasField("bar")
Run Code Online (Sandbox Code Playgroud)
但是“HasField”不适用于重复的字段类型。如何测试“重复类型”字段的字段是否存在?
message Foo {
repeated int bar = 1;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5692 次 |
| 最近记录: |