code: def testDurationIntegerConversion(self):
      message = duration_pb2.Duration()
      message.FromNanoseconds(1)
      self.assertEqual("0.000000001s", message.ToJsonString())
      self.assertEqual(1, message.ToNanoseconds())
  
      message.FromNanoseconds(-1)
      self.assertEqual("-0.000000001s", message.ToJsonString())
      self.assertEqual(-1, message.ToNanoseconds())
  
      message.FromMicroseconds(1)
      self.assertEqual("0.000001s", message.ToJsonString())
      self.assertEqual(1, message.ToMicroseconds())
  
      message.FromMicroseconds(-1)
      self.assertEqual("-0.000001s", message.ToJsonString())
      self.assertEqual(-1, message.ToMicroseconds())
  
      message.FromMilliseconds(1)
      self.assertEqual("0.001s", message.ToJsonString())
      self.assertEqual(1, message.ToMilliseconds())
  
      message.FromMilliseconds(-1)
      self.assertEqual("-0.001s", message.ToJsonString())
      self.assertEqual(-1, message.ToMilliseconds())
  
      message.FromSeconds(1)
      self.assertEqual("1s", message.ToJsonString())
      self.assertEqual(1, message.ToSeconds())
  
      message.FromSeconds(-1)
      self.assertEqual("-1s", message.ToJsonString())
      self.assertEqual(-1, message.ToSeconds())
  
      # Test truncation behavior.
      message.FromNanoseconds(1999)
      self.assertEqual(1, message.ToMicroseconds())
  
      # For negative values, Duration will be rounded towards 0.
      message.FromNanoseconds(-1999)
      self.assertEqual(-1, message.ToMicroseconds())
  
imports: from datetime import datetime
  from google.protobuf import any_pb2
  from google.protobuf import duration_pb2
  from google.protobuf import field_mask_pb2
  from google.protobuf import struct_pb2
  from google.protobuf import timestamp_pb2
  from google.protobuf import unittest_pb2
  from google.protobuf.internal import any_test_pb2
  from google.protobuf.internal import test_util
  from google.protobuf.internal import well_known_types
  from google.protobuf import descriptor
  from google.protobuf import text_format
label_desc: Use image node_id 4 for calling the TimeUtilTest obj's underlying member method code with example usage: obj.testDurationIntegerConversion() without return types