def __init__(self, initial_population, final_population, parameters, shelf_filepath, other_data=None): self.initial_population = initial_population self.final_population = final_population self.parameters = parameters self.shelf_filepath = shelf_filepath self.other_data = other_data persistence.save_with_unique_key(self.shelf_filepath, self)
def test_save_with_unique_key(self): for _ in range(10): persistence.save_with_unique_key(self.temp_file, None) with persistence.get_shelf(self.temp_file) as shelf: self.assertEqual(len(shelf), 10)