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


Python message.packed_double方法代碼示例

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


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

示例1: testPositiveInfinityPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testPositiveInfinityPacked(self, message_module):
    golden_data = (b'\xA2\x06\x04\x00\x00\x80\x7F'
                   b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\x7F')
    golden_message = message_module.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(IsPosInf(golden_message.packed_float[0]))
    self.assertTrue(IsPosInf(golden_message.packed_double[0]))
    self.assertEqual(golden_data, golden_message.SerializeToString()) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:10,代碼來源:message_test.py

示例2: testNegativeInfinityPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testNegativeInfinityPacked(self, message_module):
    golden_data = (b'\xA2\x06\x04\x00\x00\x80\xFF'
                   b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\xFF')
    golden_message = message_module.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(IsNegInf(golden_message.packed_float[0]))
    self.assertTrue(IsNegInf(golden_message.packed_double[0]))
    self.assertEqual(golden_data, golden_message.SerializeToString()) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:10,代碼來源:message_test.py

示例3: testNotANumberPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testNotANumberPacked(self, message_module):
    golden_data = (b'\xA2\x06\x04\x00\x00\xC0\x7F'
                   b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF8\x7F')
    golden_message = message_module.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(isnan(golden_message.packed_float[0]))
    self.assertTrue(isnan(golden_message.packed_double[0]))

    serialized = golden_message.SerializeToString()
    message = message_module.TestPackedTypes()
    message.ParseFromString(serialized)
    self.assertTrue(isnan(message.packed_float[0]))
    self.assertTrue(isnan(message.packed_double[0])) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:15,代碼來源:message_test.py

示例4: testPositiveInfinityPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testPositiveInfinityPacked(self):
    golden_data = (b'\xA2\x06\x04\x00\x00\x80\x7F'
                   b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\x7F')
    golden_message = unittest_pb2.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(IsPosInf(golden_message.packed_float[0]))
    self.assertTrue(IsPosInf(golden_message.packed_double[0]))
    self.assertEqual(golden_data, golden_message.SerializeToString()) 
開發者ID:katharosada,項目名稱:botchallenge,代碼行數:10,代碼來源:message_test.py

示例5: testNegativeInfinityPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testNegativeInfinityPacked(self):
    golden_data = (b'\xA2\x06\x04\x00\x00\x80\xFF'
                   b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\xFF')
    golden_message = unittest_pb2.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(IsNegInf(golden_message.packed_float[0]))
    self.assertTrue(IsNegInf(golden_message.packed_double[0]))
    self.assertEqual(golden_data, golden_message.SerializeToString()) 
開發者ID:katharosada,項目名稱:botchallenge,代碼行數:10,代碼來源:message_test.py

示例6: testNotANumberPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testNotANumberPacked(self):
    golden_data = (b'\xA2\x06\x04\x00\x00\xC0\x7F'
                   b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF8\x7F')
    golden_message = unittest_pb2.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(isnan(golden_message.packed_float[0]))
    self.assertTrue(isnan(golden_message.packed_double[0]))

    serialized = golden_message.SerializeToString()
    message = unittest_pb2.TestPackedTypes()
    message.ParseFromString(serialized)
    self.assertTrue(isnan(message.packed_float[0]))
    self.assertTrue(isnan(message.packed_double[0])) 
開發者ID:katharosada,項目名稱:botchallenge,代碼行數:15,代碼來源:message_test.py

示例7: testPositiveInfinityPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testPositiveInfinityPacked(self):
    golden_data = ('\xA2\x06\x04\x00\x00\x80\x7F'
                   '\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\x7F')
    golden_message = unittest_pb2.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(IsPosInf(golden_message.packed_float[0]))
    self.assertTrue(IsPosInf(golden_message.packed_double[0]))
    self.assertEqual(golden_data, golden_message.SerializeToString()) 
開發者ID:apple,項目名稱:coremltools,代碼行數:10,代碼來源:message_test.py

示例8: testNegativeInfinityPacked

# 需要導入模塊: from google.protobuf import message [as 別名]
# 或者: from google.protobuf.message import packed_double [as 別名]
def testNegativeInfinityPacked(self):
    golden_data = ('\xA2\x06\x04\x00\x00\x80\xFF'
                   '\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\xFF')
    golden_message = unittest_pb2.TestPackedTypes()
    golden_message.ParseFromString(golden_data)
    self.assertTrue(IsNegInf(golden_message.packed_float[0]))
    self.assertTrue(IsNegInf(golden_message.packed_double[0]))
    self.assertEqual(golden_data, golden_message.SerializeToString()) 
開發者ID:apple,項目名稱:coremltools,代碼行數:10,代碼來源:message_test.py


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