def test_repeated_nested(self): message = test_pb2.RepeatedNested() message.children.add().value = 1.2 message.children.add().value = 3.4 self.assertLen( message_helpers.find_submessages(message, test_pb2.RepeatedNested.Child), 2)
def test_repeated_nested(self): message = test_pb2.RepeatedNested() message.children.add().value = 1.2 message.children.add().value = 3.4 record = proto_to_json.get_database_json(message) self.assertLen(record, 1) self.assertLen(record['children'], 2) self.assertAlmostEqual(record['children'][0]['value'], 1.2, places=3) self.assertAlmostEqual(record['children'][1]['value'], 3.4, places=3)