Conditions | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | import unittest |
||
8 | def test_map(self): |
||
9 | trie = TernarySearchTrie() |
||
10 | self.assertTrue(trie.is_empty()) |
||
11 | trie.put('hello', 'world') |
||
12 | self.assertTrue(trie.contains_key('hello')) |
||
13 | self.assertEqual(trie.get('hello'), 'world') |
||
14 | trie.put('hi', 'there') |
||
15 | self.assertTrue(trie.contains_key('hi')) |
||
16 | self.assertEqual(trie.get('hi'), 'there') |
||
17 | self.assertEqual(trie.size(), 2) |
||
18 | for i in range(100): |
||
19 | trie.put(str(i), i) |
||
20 | self.assertTrue(trie.contains_key(str(i))) |
||
21 | self.assertEqual(trie.size(), 102) |
||
22 | trie.delete('hi') |
||
23 | self.assertFalse(trie.contains_key('hi')) |
||
24 | self.assertEqual(trie.size(), 101) |
||
25 | |||
27 | unittest.main() |