File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -426,14 +426,19 @@ def test_constructor_proto3() -> None:
426
426
# an_optional_string has optional keyword so None is allowed
427
427
x = SimpleProto3 (an_optional_string = None )
428
428
assert not x .HasField ("an_optional_string" )
429
+ # Field access still returns the 0-value, even though
430
+ # the field is not present.
431
+ assert x .an_optional_string == ""
429
432
430
433
x = SimpleProto3 (a_string = "" , an_optional_string = "" )
431
434
assert x .a_string == ""
432
435
assert x .HasField ("an_optional_string" )
436
+ assert x .an_optional_string == ""
433
437
434
438
x = SimpleProto3 (a_string = "hello" , an_optional_string = "hello" )
435
439
assert x .a_string == "hello"
436
440
assert x .HasField ("an_optional_string" )
441
+ assert x .an_optional_string == "hello"
437
442
438
443
439
444
def test_message_descriptor_proto2 () -> None :
You can’t perform that action at this time.
0 commit comments