File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 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:
426426 # an_optional_string has optional keyword so None is allowed
427427 x = SimpleProto3 (an_optional_string = None )
428428 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 == ""
429432
430433 x = SimpleProto3 (a_string = "" , an_optional_string = "" )
431434 assert x .a_string == ""
432435 assert x .HasField ("an_optional_string" )
436+ assert x .an_optional_string == ""
433437
434438 x = SimpleProto3 (a_string = "hello" , an_optional_string = "hello" )
435439 assert x .a_string == "hello"
436440 assert x .HasField ("an_optional_string" )
441+ assert x .an_optional_string == "hello"
437442
438443
439444def test_message_descriptor_proto2 () -> None :
You can’t perform that action at this time.
0 commit comments