Exemple #1
0
    def test_all_pairs_random_size_and_strings(self):
        t = TST()

        n = random.randint(3, 1000)
        random_pairs = {}

        for _ in range(n):
            key = TestTST.gen_rand_str(random.randint(1, 17))
            random_pairs[key] = key
            t.insert(key, key)

        self.assertEqual(t.all_pairs(), random_pairs)
Exemple #2
0
 def test_all_pairs_tst_size_1(self):
     t = TST()
     t.insert("the most sadistic", "necro")
     self.assertEqual(t.all_pairs(), {"the most sadistic": "necro"})
Exemple #3
0
 def test_all_pairs_empty_tst(self):
     t = TST()
     self.assertEqual(t.all_pairs(), {})