def test_perform_from_load(self): """Test checking for correct loading from pref and that we can still recall values from the database """ self.task.write_in_database('pi', 3.1) self.task.formulas = ordered_dict_from_pref(self, self.task.formulas, "[(u'key1', '1.0+3.0'), (u'key2', '3.0 + {Test_pi}')]") self.root.prepare() self.task.perform() assert (self.task.get_from_database('Test_key1') == 4.0 and self.task.get_from_database('Test_key2') == 6.1)
def test_check_after_load(self): """Test checking for correct loading from pref and that we can still recall values from the database """ self.task.write_in_database('it', 'World') pref = "[(u'key1', u'1.0+3.0'), (u'key2', u'Hello')]" self.task.definitions = ordered_dict_from_pref(self, self.task.definitions, pref) self.root.prepare() self.task.check() assert self.task.get_from_database('Test_key1') == safe_eval( "1.0+3.0", {}) assert self.task.get_from_database('Test_key2') == "Hello"