def test_data_is_shared_between_instances(self): config1 = UserConfig() config1["param1"] = "value1" config1.save() config2 = UserConfig() self.assertEquals(config2["param1"], "value1")
def test_data_can_be_reloaded_from_file(self): config1 = UserConfig() config1["param1"] = "value1" config1.save() config1["param1"] = "value2" config1.load() self.assertEquals(config1["param1"], "value1")
def test_complex_data_can_be_saved(self): config1 = UserConfig() for i, val in enumerate(self.values): param_name = "param_{0}".format(i) config1[param_name] = val config1.save() config2 = UserConfig() for i, val in enumerate(self.values): param_name = "param_{0}".format(i) self.assertEqual(config2[param_name], val)
def _delete_persistent_data(self): if os.path.exists(UserConfig.getPersistentPath()): os.remove(UserConfig.getPersistentPath())