Skip to content

Commit

Permalink
-Make message __deepcopy__ call UPB code instead of default implement…
Browse files Browse the repository at this point in the history
…ation for python UPB (splitted change 1)

PiperOrigin-RevId: 528083849
  • Loading branch information
anandolee authored and copybara-github committed Apr 29, 2023
1 parent 0f61acd commit 65e047d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/google/protobuf/internal/message_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,11 @@ def testGoldenExtensions(self):
self.assertEqual(all_set, golden_message)
self.assertEqual(golden_data, golden_message.SerializeToString())
golden_copy = copy.deepcopy(golden_message)
self.assertEqual(golden_data, golden_copy.SerializeToString())
self.assertEqual(golden_message, golden_copy)
# Depend on a specific serialization order for extensions is not
# reasonable to guarantee.
if api_implementation.Type() != 'upb':
self.assertEqual(golden_data, golden_copy.SerializeToString())

def testGoldenPackedExtensions(self):
golden_data = test_util.GoldenFileData('golden_packed_fields_message')
Expand All @@ -1420,7 +1424,11 @@ def testGoldenPackedExtensions(self):
self.assertEqual(all_set, golden_message)
self.assertEqual(golden_data, all_set.SerializeToString())
golden_copy = copy.deepcopy(golden_message)
self.assertEqual(golden_data, golden_copy.SerializeToString())
self.assertEqual(golden_message, golden_copy)
# Depend on a specific serialization order for extensions is not
# reasonable to guarantee.
if api_implementation.Type() != 'upb':
self.assertEqual(golden_data, golden_copy.SerializeToString())

def testPickleIncompleteProto(self):
golden_message = unittest_pb2.TestRequired(a=1)
Expand Down

0 comments on commit 65e047d

Please sign in to comment.