diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py index cdcc5b09ed..dce675354b 100755 --- a/python/google/protobuf/internal/message_test.py +++ b/python/google/protobuf/internal/message_test.py @@ -53,6 +53,7 @@ cmp = lambda x, y: (x > y) - (x < y) from google.protobuf.internal import api_implementation # pylint: disable=g-import-not-at-top from google.protobuf.internal import encoder from google.protobuf.internal import more_extensions_pb2 +from google.protobuf.internal import more_messages_pb2 from google.protobuf.internal import packed_field_test_pb2 from google.protobuf.internal import test_proto3_optional_pb2 from google.protobuf.internal import test_util @@ -496,6 +497,13 @@ class MessageTest(unittest.TestCase): msg.repeated_nested_message.MergeFrom(other_msg.repeated_nested_message) self.assertEqual([1, 2, 3, 4], [m.bb for m in msg.repeated_nested_message]) + @unittest.skipIf( + api_implementation.Type() == 'upb', + "We can enable after protobuf updates to use the current upb repo") + def testInternalMergeWithMissingRequiredField(self, message_module): + req = more_messages_pb2.RequiredField() + more_messages_pb2.RequiredWrapper(request=req) + def testAddWrongRepeatedNestedField(self, message_module): msg = message_module.TestAllTypes() try: diff --git a/python/google/protobuf/internal/more_messages.proto b/python/google/protobuf/internal/more_messages.proto index 524dc701a9..3c5c971fae 100644 --- a/python/google/protobuf/internal/more_messages.proto +++ b/python/google/protobuf/internal/more_messages.proto @@ -358,3 +358,11 @@ message LotsNestedMessage { message B254 {} message B255 {} } + +message RequiredField { + required int32 id = 1; +} + +message RequiredWrapper { + optional RequiredField request = 1; +}