def test_remove_middle(self): ll = LinkedList() ll.append(1) ll.append(2) ll.append(3) ll.remove(1) self.assertEqual(3, ll.get(1))
def test_append_on_removed(self): ll = LinkedList() ll.append(1) ll.remove(0) ll.append(2) # self.assertEqual(ll.get(0), 1) self.assertEqual(ll.get(0), 2)
def test_get_middle(self): ll = LinkedList() ll.append(0) ll.append(1) ll.append(2) ll.append(3) ll.append(4) self.assertEqual(ll.get(2), 2)
def test_get(self): ll = LinkedList() a = 2 ll.append(a) self.assertEqual(ll.get(0), a)
def test_append_when_empty(self): ll = LinkedList() ll.append(1) self.assertEqual(ll.get(0), 1)
def test_create_from_list(self): l = [1, 2, 3] ll = LinkedList(l) for i in range(len(l)): self.assertEqual(l[i], ll.get(i))
def test_append_when_not_empty(self): ll = LinkedList() ll.append(1) ll.append(2) self.assertEqual(ll.get(1), 2)