code: def testExtremeDoubleValues(self):
      message = unittest_pb2.TestAllTypes()
  
      # Most positive exponent, no significand bits set.
      kMostPosExponentNoSigBits = math.pow(2, 1023)
      message.optional_double = kMostPosExponentNoSigBits
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == kMostPosExponentNoSigBits
      )
  
      # Most positive exponent, one significand bit set.
      kMostPosExponentOneSigBit = 1.5 * math.pow(2, 1023)
      message.optional_double = kMostPosExponentOneSigBit
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == kMostPosExponentOneSigBit
      )
  
      # Repeat last two cases with values of same magnitude, but negative.
      message.optional_double = -kMostPosExponentNoSigBits
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == -kMostPosExponentNoSigBits
      )
  
      message.optional_double = -kMostPosExponentOneSigBit
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == -kMostPosExponentOneSigBit
      )
  
      # Most negative exponent, no significand bits set.
      kMostNegExponentNoSigBits = math.pow(2, -1023)
      message.optional_double = kMostNegExponentNoSigBits
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == kMostNegExponentNoSigBits
      )
  
      # Most negative exponent, one significand bit set.
      kMostNegExponentOneSigBit = 1.5 * math.pow(2, -1023)
      message.optional_double = kMostNegExponentOneSigBit
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == kMostNegExponentOneSigBit
      )
  
      # Repeat last two cases with values of the same magnitude, but negative.
      message.optional_double = -kMostNegExponentNoSigBits
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == -kMostNegExponentNoSigBits
      )
  
      message.optional_double = -kMostNegExponentOneSigBit
      message.ParseFromString(message.SerializeToString())
      self.assertTrue(
          message.optional_double == -kMostNegExponentOneSigBit
      )
  
imports: import copy
  import math
  import operator
  import pickle
  import unittest
  from google.protobuf import unittest_import_pb2
  from google.protobuf import unittest_pb2
  from google.protobuf.internal import api_implementation
  from google.protobuf.internal import test_util
  from google.protobuf import message
label_desc: Use image node_id 14 for calling the MessageTest obj's underlying member method code with example usage: obj.testExtremeDoubleValues() without return types