def testPrintAllExtensionsPointy(self):
   message = unittest_pb2.TestAllExtensions()
   test_util.SetAllExtensions(message)
   self.CompareToGoldenFile(
       self.RemoveRedundantZeros(text_format.MessageToString(
           message, pointy_brackets=True)),
       'text_format_unittest_extensions_data_pointy.txt')
Example #2
0
 def testMergeAllExtensions(self):
     message = unittest_pb2.TestAllExtensions()
     test_util.SetAllExtensions(message)
     ascii_text = text_format.MessageToString(message)
     parsed_message = unittest_pb2.TestAllExtensions()
     text_format.Merge(ascii_text, parsed_message)
     self.assertEqual(message, parsed_message)
Example #3
0
 def testGoldenExtensions(self):
     golden_data = test_util.GoldenFile('golden_message').read()
     golden_message = unittest_pb2.TestAllExtensions()
     golden_message.ParseFromString(golden_data)
     all_set = unittest_pb2.TestAllExtensions()
     test_util.SetAllExtensions(all_set)
     self.assertEquals(all_set, golden_message)
     self.assertTrue(golden_message.SerializeToString() == golden_data)
  def testParseGoldenExtensions(self):
    golden_text = '\n'.join(self.ReadGolden(
        'text_format_unittest_extensions_data.txt'))
    parsed_message = unittest_pb2.TestAllExtensions()
    text_format.Parse(golden_text, parsed_message)

    message = unittest_pb2.TestAllExtensions()
    test_util.SetAllExtensions(message)
    self.assertEquals(message, parsed_message)
 def testGoldenExtensions(self):
   golden_data = test_util.GoldenFileData('golden_message')
   golden_message = unittest_pb2.TestAllExtensions()
   golden_message.ParseFromString(golden_data)
   all_set = unittest_pb2.TestAllExtensions()
   test_util.SetAllExtensions(all_set)
   self.assertEqual(all_set, golden_message)
   self.assertEqual(golden_data, golden_message.SerializeToString())
   golden_copy = copy.deepcopy(golden_message)
   self.assertEqual(golden_data, golden_copy.SerializeToString())
Example #6
0
 def testPrintAllExtensions(self):
     message = unittest_pb2.TestAllExtensions()
     test_util.SetAllExtensions(message)
     self.CompareToGoldenFile(text_format.MessageToString(message),
                              'text_format_unittest_extensions_data.txt')