def test_find(self):
     dll = DoublyLinkedList()
     dll.append('A')
     dll.append('B')
     dll.append('C')
     assert dll.find(lambda item: item == 'B') == 'B'
     assert dll.find(lambda item: item < 'B') == 'A'
     assert dll.find(lambda item: item > 'B') == 'C'
     assert dll.find(lambda item: item == 'D') is None
Ejemplo n.º 2
0
 def test_find(self):
     ll = DoublyLinkedList(['A', 'B', 'C'])
     assert ll.find(lambda item: item == 'B') == 'B'
     assert ll.find(lambda item: item < 'B') == 'A'
     assert ll.find(lambda item: item > 'B') == 'C'
     assert ll.find(lambda item: item == 'X') is None
Ejemplo n.º 3
0
 def test_find(self):
     dll = DoublyLinkedList(['A', 'B', 'C'])
     assert dll.find(lambda item: item == 'B') == 'B'  # Match equality
     assert dll.find(lambda item: item < 'B') == 'A'  # Match less than
     assert dll.find(lambda item: item > 'B') == 'C'  # Match greater than
     assert dll.find(lambda item: item == 'X') is None  # No matching item