Python google.protobuf.text_format.MergeLines() Examples

The following are 9 code examples for showing how to use google.protobuf.text_format.MergeLines(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module google.protobuf.text_format , or try the search function .

Example 1
Project: lambda-packs   Author: ryfeus   File: text_format_test.py    License: MIT License 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 2
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: text_format_test.py    License: MIT License 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 3
Project: sklearn-theano   Author: sklearn-theano   File: text_format_test.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 4
Project: botchallenge   Author: katharosada   File: text_format_test.py    License: MIT License 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 5
Project: coremltools   Author: apple   File: text_format_test.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 6
Project: go2mapillary   Author: enricofer   File: text_format_test.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 7
Project: agents   Author: tensorflow   File: tensor_spec.py    License: Apache License 2.0 5 votes vote down vote up
def from_pbtxt_file(spec_path):
  """Loads a spec encoded as a struct_pb2.StructuredValue from a pbtxt file."""
  spec_proto = struct_pb2.StructuredValue()
  with tf.io.gfile.GFile(spec_path, "rb") as f:
    text_format.MergeLines(f, spec_proto)
  return from_proto(spec_proto) 
Example 8
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message) 
Example 9
Project: keras-lambda   Author: sunilmallya   File: text_format_test.py    License: MIT License 5 votes vote down vote up
def testMergeLinesGolden(self):
    opened = self.ReadGolden('text_format_unittest_data_oneof_implemented.txt')
    parsed_message = unittest_pb2.TestAllTypes()
    r = text_format.MergeLines(opened, parsed_message)
    self.assertIs(r, parsed_message)

    message = unittest_pb2.TestAllTypes()
    test_util.SetAllFields(message)
    self.assertEqual(message, parsed_message)