Пример #1
0
 def setUp(self):
     super().setUp()
     self.messages = [
         test_pb2.Scalar(int32_value=3, float_value=4.5),
         test_pb2.RepeatedScalar(values=[1.2, 3.4]),
         test_pb2.Enum(value='FIRST'),
         test_pb2.RepeatedEnum(values=['FIRST', 'SECOND']),
         test_pb2.Nested(child=test_pb2.Nested.Child(value=1.2)),
     ]
Пример #2
0
 def test_enum(self):
     message = test_pb2.Enum(value='FIRST')
     record = proto_to_json.get_database_json(message)
     expected = {'value': 'FIRST'}
     self.assertEqual(record, expected)