Esempio n. 1
0
 def test_set_a_q_special_chars_wc(self):
     testdb = DB(SQLiteRepo())
     init = (
         ('a***', 10),
         ('b???', 20),
     )
     testdb.import_data(init)
     expected = [
         ('a***', 10),
         ('b???', 888),
     ]
     testdb.set_a_q('b???', 888, wildcards=False)
     samp = list(testdb.export())
     self.assertEqual(samp, expected)
Esempio n. 2
0
    def test_set_a_q_long_content(self):
        """Set Anchor q-value with long-form content

        The preface of the content must be able to set the Anchor's q-value

        """
        testrepo = SQLiteRepo()
        testdb = DB(testrepo)
        suffix = "N" * testrepo.preface_length
        init = [
            ("{}{}".format("Z", suffix), 0),
            ('Z', 0),
        ]
        expected = [
            ("{}{}".format("Z", suffix), 99),
            ('Z', 0),
        ]
        testdb.import_data(init)
        testdb.set_a_q("{}{}".format("Z", suffix[:-1]), 99)
        samp = list(testdb.export())
        self.assertEqual(samp, expected)