本文整理匯總了Python中google.protobuf.unittest_pb2._FOREIGNENUM屬性的典型用法代碼示例。如果您正苦於以下問題:Python unittest_pb2._FOREIGNENUM屬性的具體用法?Python unittest_pb2._FOREIGNENUM怎麽用?Python unittest_pb2._FOREIGNENUM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類google.protobuf.unittest_pb2
的用法示例。
在下文中一共展示了unittest_pb2._FOREIGNENUM屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testPackage
# 需要導入模塊: from google.protobuf import unittest_pb2 [as 別名]
# 或者: from google.protobuf.unittest_pb2 import _FOREIGNENUM [as 別名]
def testPackage(self):
self.assertEqual(
unittest_pb2.TestAllTypes.DESCRIPTOR.file.package,
'protobuf_unittest')
desc = unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR
self.assertEqual(desc.file.package, 'protobuf_unittest')
self.assertEqual(
unittest_import_pb2.ImportMessage.DESCRIPTOR.file.package,
'protobuf_unittest_import')
self.assertEqual(
unittest_pb2._FOREIGNENUM.file.package, 'protobuf_unittest')
self.assertEqual(
unittest_pb2._TESTALLTYPES_NESTEDENUM.file.package,
'protobuf_unittest')
self.assertEqual(
unittest_import_pb2._IMPORTENUM.file.package,
'protobuf_unittest_import')
示例2: testCopyToProto_ForeignEnum
# 需要導入模塊: from google.protobuf import unittest_pb2 [as 別名]
# 或者: from google.protobuf.unittest_pb2 import _FOREIGNENUM [as 別名]
def testCopyToProto_ForeignEnum(self):
TEST_FOREIGN_ENUM_ASCII = """
name: 'ForeignEnum'
value: <
name: 'FOREIGN_FOO'
number: 4
>
value: <
name: 'FOREIGN_BAR'
number: 5
>
value: <
name: 'FOREIGN_BAZ'
number: 6
>
"""
self._InternalTestCopyToProto(
unittest_pb2._FOREIGNENUM,
descriptor_pb2.EnumDescriptorProto,
TEST_FOREIGN_ENUM_ASCII)
示例3: testContainingTypeInEnumDescriptor
# 需要導入模塊: from google.protobuf import unittest_pb2 [as 別名]
# 或者: from google.protobuf.unittest_pb2 import _FOREIGNENUM [as 別名]
def testContainingTypeInEnumDescriptor(self):
self.assertTrue(unittest_pb2._FOREIGNENUM.containing_type is None)
self.assertEqual(unittest_pb2._TESTALLTYPES_NESTEDENUM.containing_type,
unittest_pb2.TestAllTypes.DESCRIPTOR)
示例4: testEnumTypesByName
# 需要導入模塊: from google.protobuf import unittest_pb2 [as 別名]
# 或者: from google.protobuf.unittest_pb2 import _FOREIGNENUM [as 別名]
def testEnumTypesByName(self):
file_type = unittest_pb2.DESCRIPTOR
self.assertEqual(
unittest_pb2._FOREIGNENUM,
file_type.enum_types_by_name[unittest_pb2._FOREIGNENUM.name])