code: def testDiscardUnknownFields(self):
      self.empty_message.DiscardUnknownFields()
      self.assertEqual(b"", self.empty_message.SerializeToString())
      # Test message field and repeated message field.
      message = unittest_pb2.TestAllTypes()
      other_message = unittest_pb2.TestAllTypes()
      other_message.optional_string = "discard"
      message.optional_nested_message.ParseFromString(
          other_message.SerializeToString()
      )
      message.repeated_nested_message.add().ParseFromString(
          other_message.SerializeToString()
      )
      self.assertNotEqual(
          b"", message.optional_nested_message.SerializeToString()
      )
      self.assertNotEqual(
          b"", message.repeated_nested_message[0].SerializeToString()
      )
      message.DiscardUnknownFields()
      self.assertEqual(
          b"", message.optional_nested_message.SerializeToString()
      )
      self.assertEqual(
          b"", message.repeated_nested_message[0].SerializeToString()
      )
  
imports: from google.protobuf import unittest_mset_pb2
  from google.protobuf import unittest_pb2
  from google.protobuf import unittest_proto3_arena_pb2
  from google.protobuf.internal import api_implementation
  from google.protobuf.internal import encoder
  from google.protobuf.internal import message_set_extensions_pb2
  from google.protobuf.internal import missing_enum_values_pb2
  from google.protobuf.internal import test_util
  from google.protobuf.internal import testing_refleaks
  from google.protobuf.internal import type_checkers
label_desc: Use image node_id 8 for calling the UnknownFieldsTest obj's underlying member method code with example usage: obj.testDiscardUnknownFields() without return types