コード例 #1
0
    def test_perform1(self):
        """Test checking that the formatted definition gets written to the
        database

        """
        self.task.write_in_database('it', 'World')
        self.task.definitions = OrderedDict([('key1', "2.0+3.0"),
                                             ('key2', 'Hello')])
        self.root.prepare()

        self.task.check()
        assert self.task.get_from_database('Test_key1') == safe_eval(
            "1.0+4.0", {})
        assert self.task.get_from_database('Test_key2') == "Hello"
コード例 #2
0
    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"