Beispiel #1
0
 def test_contains(self):
     ht = TreeMap()
     ht.set('I', 1)
     ht.set('V', 5)
     ht.set('X', 10)
     assert ht.contains('I') is True
     assert ht.contains('V') is True
     assert ht.contains('X') is True
     assert ht.contains('A') is False
Beispiel #2
0
 def test_set(self):
     tree = TreeMap()
     tree.set(2, 'B')
     assert tree.contains(2)
     assert tree.get(2) == 'B'
     tree.set(1, 'A')
     assert tree.contains(1)
     assert tree.get(1) == 'A'
     tree.set(3, 'C')
     assert tree.contains(3)
     assert tree.get(3) == 'C'
Beispiel #3
0
 def test_delete(self):
     tree = TreeMap([(2, 'B'), (1, 'A'), (3, 'C')])
     tree.delete(2)
     assert not tree.contains(2)
     assert tree.contains(1)
     assert tree.contains(3)
     tree.delete(1)
     assert not tree.contains(1)
     assert tree.contains(3)
     tree.delete(3)
     assert tree.is_empty()
     assert not tree.contains(3)
 def test_contains(self):
     treemap = TreeMap()
     treemap.set('A', 3)
     assert treemap.contains('A')
     assert treemap.contains('B') is False
Beispiel #5
0
 def test_contains(self):
     tree = TreeMap([(2, 'B'), (1, 'A'), (3, 'C')])
     assert tree.contains(2)
     assert tree.contains(1)
     assert tree.contains(3)
Beispiel #6
0
 def test_contains(self):
     tm = TreeMap([(1, 2), (2, 3), (3, 4)])
     assert tm.contains(1) is True
     assert tm.contains(2) is True
     assert tm.contains(3) is True
     assert tm.contains(4) is False