code: def testSimpleCustomOptions(self):
      file_descriptor = unittest_custom_options_pb2.DESCRIPTOR
      message_descriptor = (
          unittest_custom_options_pb2.TestMessageWithCustomOptions.DESCRIPTOR
      )
      field_descriptor = message_descriptor.fields_by_name["field1"]
      oneof_descriptor = message_descriptor.oneofs_by_name["AnOneof"]
      enum_descriptor = message_descriptor.enum_types_by_name["AnEnum"]
      enum_value_descriptor = message_descriptor.enum_values_by_name[
          "ANENUM_VAL2"
      ]
      service_descriptor = (
          unittest_custom_options_pb2.TestServiceWithCustomOptions.DESCRIPTOR
      )
      method_descriptor = service_descriptor.FindMethodByName("Foo")
  
      file_options = file_descriptor.GetOptions()
      file_opt1 = unittest_custom_options_pb2.file_opt1
      self.assertEqual(9876543210, file_options.Extensions[file_opt1])
      message_options = message_descriptor.GetOptions()
      message_opt1 = unittest_custom_options_pb2.message_opt1
      self.assertEqual(-56, message_options.Extensions[message_opt1])
      field_options = field_descriptor.GetOptions()
      field_opt1 = unittest_custom_options_pb2.field_opt1
      self.assertEqual(8765432109, field_options.Extensions[field_opt1])
      field_opt2 = unittest_custom_options_pb2.field_opt2
      self.assertEqual(42, field_options.Extensions[field_opt2])
      oneof_options = oneof_descriptor.GetOptions()
      oneof_opt1 = unittest_custom_options_pb2.oneof_opt1
      self.assertEqual(-99, oneof_options.Extensions[oneof_opt1])
      enum_options = enum_descriptor.GetOptions()
      enum_opt1 = unittest_custom_options_pb2.enum_opt1
      self.assertEqual(-789, enum_options.Extensions[enum_opt1])
      enum_value_options = enum_value_descriptor.GetOptions()
      enum_value_opt1 = unittest_custom_options_pb2.enum_value_opt1
      self.assertEqual(
          123, enum_value_options.Extensions[enum_value_opt1]
      )
  
      service_options = service_descriptor.GetOptions()
      service_opt1 = unittest_custom_options_pb2.service_opt1
      self.assertEqual(
          -9876543210, service_options.Extensions[service_opt1]
      )
      method_options = method_descriptor.GetOptions()
      method_opt1 = unittest_custom_options_pb2.method_opt1
      self.assertEqual(
          unittest_custom_options_pb2.METHODOPT1_VAL2,
          method_options.Extensions[method_opt1],
      )
  
      message_descriptor = (
          unittest_custom_options_pb2.DummyMessageContainingEnum.DESCRIPTOR
      )
      self.assertTrue(file_descriptor.has_options)
      self.assertFalse(message_descriptor.has_options)
  
imports: import sys
  from google.protobuf import unittest_custom_options_pb2
  from google.protobuf import unittest_import_pb2
  from google.protobuf import unittest_pb2
  from google.protobuf import descriptor_pb2
  from google.protobuf.internal import api_implementation
  from google.protobuf.internal import test_util
  from google.protobuf import descriptor
  from google.protobuf import descriptor_pool
  from google.protobuf import symbol_database
  from google.protobuf import text_format
label_desc: Use image node_id 8 for calling the DescriptorTest obj's underlying member method code with example usage: obj.testSimpleCustomOptions() without return types