Example #1
0
 def test_path_readonly(self):
     with self.assertRaises(AttributeError):
         n = trie.Node()
         n.path = 'a'
Example #2
0
 def test_slots(self):
     with self.assertRaises(AttributeError):
         n = trie.Node()
         n.data = None
Example #3
0
 def test_len(self):
     keys = [(k, Ellipsis) for k in range(128, 256)]
     n = trie.Node()
     for k, v in keys:
         n[k] = v
     self.assertEqual(len(n), 128)
Example #4
0
 def test_set_path(self):
     n = trie.Node('a')
     self.assertEqual(n.path, 'a')
Example #5
0
 def test_iterate(self):
     keys = [(k, Ellipsis) for k in range(128, 256)]
     n = trie.Node()
     for k, v in keys:
         n[k] = v
     self.assertSequenceEqual(list(iter(n)), keys)
Example #6
0
 def test_contains(self):
     n = trie.Node()
     self.assertFalse(0 in n)
     n[0] = Ellipsis
     self.assertTrue(0 in n)
Example #7
0
 def test_set_set(self):
     n = trie.Node()
     n[0] = False
     self.assertIs(n[0], False)
     n[0] = True
     self.assertIs(n[0], True)
Example #8
0
 def test_set_del(self):
     n = trie.Node()
     n[0] = Ellipsis
     del n[0]
     self.assertIs(n[0], None)
Example #9
0
 def test_set_get(self):
     n = trie.Node()
     n[0] = Ellipsis
     self.assertIs(n[0], Ellipsis)