def test_pop(self): sll = LinkedList() end = 10 assert sll.size == 0 assert sll.head is None for i in range(end): sll.push(i) assert sll.head is not None assert sll.size == 1 assert sll.pop() is not None assert sll.size == 0 assert sll.head is None for j in range(end): sll.push(j) assert sll.size == end assert sll.head is not None for k in range(end): assert sll.pop() is not None assert sll.size == 0 assert sll.head is None
def test_pop_empty(self): sll = LinkedList() with pytest.raises(IndexError): sll.pop()