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)), ]
def test_repeated_enum(self): message = test_pb2.RepeatedEnum(values=['FIRST', 'FIRST', 'SECOND']) record = proto_to_json.get_database_json(message) expected = {'values': ['FIRST', 'FIRST', 'SECOND']} self.assertEqual(record, expected)