當前位置: 首頁>>代碼示例>>Python>>正文


Python missing_enum_values_pb2.TestMissingEnumValues方法代碼示例

本文整理匯總了Python中google.protobuf.internal.missing_enum_values_pb2.TestMissingEnumValues方法的典型用法代碼示例。如果您正苦於以下問題:Python missing_enum_values_pb2.TestMissingEnumValues方法的具體用法?Python missing_enum_values_pb2.TestMissingEnumValues怎麽用?Python missing_enum_values_pb2.TestMissingEnumValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在google.protobuf.internal.missing_enum_values_pb2的用法示例。


在下文中一共展示了missing_enum_values_pb2.TestMissingEnumValues方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from google.protobuf.internal import missing_enum_values_pb2 [as 別名]
# 或者: from google.protobuf.internal.missing_enum_values_pb2 import TestMissingEnumValues [as 別名]
def setUp(self):
    self.descriptor = missing_enum_values_pb2.TestEnumValues.DESCRIPTOR

    self.message = missing_enum_values_pb2.TestEnumValues()
    # TestEnumValues.ZERO = 0, but does not exist in the other NestedEnum.
    self.message.optional_nested_enum = (
        missing_enum_values_pb2.TestEnumValues.ZERO)
    self.message.repeated_nested_enum.extend([
        missing_enum_values_pb2.TestEnumValues.ZERO,
        missing_enum_values_pb2.TestEnumValues.ONE,
        ])
    self.message.packed_nested_enum.extend([
        missing_enum_values_pb2.TestEnumValues.ZERO,
        missing_enum_values_pb2.TestEnumValues.ONE,
        ])
    self.message_data = self.message.SerializeToString()
    self.missing_message = missing_enum_values_pb2.TestMissingEnumValues()
    self.missing_message.ParseFromString(self.message_data)

  # CheckUnknownField() is an additional Pure Python check which checks
  # a detail of unknown fields. It cannot be used by the C++
  # implementation because some protect members are called.
  # The test is added for historical reasons. It is not necessary as
  # serialized string is checked. 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:26,代碼來源:unknown_fields_test.py

示例2: setUp

# 需要導入模塊: from google.protobuf.internal import missing_enum_values_pb2 [as 別名]
# 或者: from google.protobuf.internal.missing_enum_values_pb2 import TestMissingEnumValues [as 別名]
def setUp(self):
    self.descriptor = missing_enum_values_pb2.TestEnumValues.DESCRIPTOR

    self.message = missing_enum_values_pb2.TestEnumValues()
    # TestEnumValues.ZERO = 0, but does not exist in the other NestedEnum.
    self.message.optional_nested_enum = (
        missing_enum_values_pb2.TestEnumValues.ZERO)
    self.message.repeated_nested_enum.extend([
        missing_enum_values_pb2.TestEnumValues.ZERO,
        missing_enum_values_pb2.TestEnumValues.ONE,
        ])
    self.message.packed_nested_enum.extend([
        missing_enum_values_pb2.TestEnumValues.ZERO,
        missing_enum_values_pb2.TestEnumValues.ONE,
        ])
    self.message_data = self.message.SerializeToString()
    self.missing_message = missing_enum_values_pb2.TestMissingEnumValues()
    self.missing_message.ParseFromString(self.message_data)

  # GetUnknownField() checks a detail of the Python implementation, which stores
  # unknown fields as serialized strings. It cannot be used by the C++
  # implementation: it's enough to check that the message is correctly
  # serialized. 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:25,代碼來源:unknown_fields_test.py

示例3: setUp

# 需要導入模塊: from google.protobuf.internal import missing_enum_values_pb2 [as 別名]
# 或者: from google.protobuf.internal.missing_enum_values_pb2 import TestMissingEnumValues [as 別名]
def setUp(self):
    self.descriptor = missing_enum_values_pb2.TestEnumValues.DESCRIPTOR

    self.message = missing_enum_values_pb2.TestEnumValues()
    self.message.optional_nested_enum = (
      missing_enum_values_pb2.TestEnumValues.ZERO)
    self.message.repeated_nested_enum.extend([
      missing_enum_values_pb2.TestEnumValues.ZERO,
      missing_enum_values_pb2.TestEnumValues.ONE,
      ])
    self.message.packed_nested_enum.extend([
      missing_enum_values_pb2.TestEnumValues.ZERO,
      missing_enum_values_pb2.TestEnumValues.ONE,
      ])
    self.message_data = self.message.SerializeToString()
    self.missing_message = missing_enum_values_pb2.TestMissingEnumValues()
    self.missing_message.ParseFromString(self.message_data)
    if api_implementation.Type() != 'cpp':
      # _unknown_fields is an implementation detail.
      self.unknown_fields = self.missing_message._unknown_fields

  # All the tests that use GetField() check an implementation detail of the
  # Python implementation, which stores unknown fields as serialized strings.
  # These tests are skipped by the C++ implementation: it's enough to check that
  # the message is correctly serialized. 
開發者ID:sklearn-theano,項目名稱:sklearn-theano,代碼行數:27,代碼來源:unknown_fields_test.py

示例4: setUp

# 需要導入模塊: from google.protobuf.internal import missing_enum_values_pb2 [as 別名]
# 或者: from google.protobuf.internal.missing_enum_values_pb2 import TestMissingEnumValues [as 別名]
def setUp(self):
    self.descriptor = missing_enum_values_pb2.TestEnumValues.DESCRIPTOR

    self.message = missing_enum_values_pb2.TestEnumValues()
    self.message.optional_nested_enum = (
      missing_enum_values_pb2.TestEnumValues.ZERO)
    self.message.repeated_nested_enum.extend([
      missing_enum_values_pb2.TestEnumValues.ZERO,
      missing_enum_values_pb2.TestEnumValues.ONE,
      ])
    self.message.packed_nested_enum.extend([
      missing_enum_values_pb2.TestEnumValues.ZERO,
      missing_enum_values_pb2.TestEnumValues.ONE,
      ])
    self.message_data = self.message.SerializeToString()
    self.missing_message = missing_enum_values_pb2.TestMissingEnumValues()
    self.missing_message.ParseFromString(self.message_data)
    self.unknown_fields = self.missing_message._unknown_fields 
開發者ID:katharosada,項目名稱:botchallenge,代碼行數:20,代碼來源:unknown_fields_test.py


注:本文中的google.protobuf.internal.missing_enum_values_pb2.TestMissingEnumValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。