class_docstr: Tests for the properties of descriptors in generated code.
class_docstr_tok: ["Tests","for","the","properties","of","descriptors","in","generated","code","."]
code: def CheckDescriptorMapping(self, mapping):
      # Verifies that a property like 'messageDescriptor.fields' has all the
      # properties of an immutable abc.Mapping.
      self.assertGreater(len(mapping), 0)  # Sized
      self.assertEqual(len(mapping), len(list(mapping)))  # Iterable
      if sys.version_info >= (3,):
          key, item = next(iter(mapping.items()))
      else:
          key, item = mapping.items()[0]
      self.assertIn(key, mapping)  # Container
      self.assertEqual(mapping.get(key), item)
      # keys(), iterkeys() &co
      item = (next(iter(mapping.keys())), next(iter(mapping.values())))
      self.assertEqual(item, next(iter(mapping.items())))
      if sys.version_info < (3,):
  
          def CheckItems(seq, iterator):
              self.assertEqual(next(iterator), seq[0])
              self.assertEqual(list(iterator), seq[1:])
  
          CheckItems(mapping.keys(), mapping.iterkeys())
          CheckItems(mapping.values(), mapping.itervalues())
          CheckItems(mapping.items(), mapping.iteritems())
  
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 4 for calling the GeneratedDescriptorTest obj's underlying member method code with example usage: obj.CheckDescriptorMapping(mapping) without return types