def test_append(self):
     mylist = LinkedList()
     mylist.append(0)
     assert mylist.toList() == [0]
     mylist.add(1)
     assert mylist.toList() == [1, 0]
     mylist.append(5)
     assert mylist.toList() == [1, 0, 5]
 def test_reverse(self):
     mylist = LinkedList()
     mylist.add(1)
     mylist.add(2)
     mylist.add(3)
     assert mylist.toList() == [3, 2, 1]
     mylist.reverse()
     assert mylist.toList() == [1, 2, 3]
     mylist.reverse()
     assert mylist.toList() == [3, 2, 1]
 def test_remove_first(self):
     mylist = LinkedList()
     mylist.add(1)
     mylist.add(2)
     mylist.add(3)
     mylist.remove(3)
     assert mylist.toList() == [2, 1]
 def test_remove_last(self):
     mylist = LinkedList()
     mylist.add(1)
     mylist.add(2)
     mylist.add(3)
     mylist.remove(1)
     assert mylist.toList() == [3, 2]
 def test_many_duplicates(self):
     mylist = LinkedList()
     mylist.add(3)
     mylist.add(3)
     mylist.add(3)
     mylist.remove(3)
     assert mylist.toList() == [3, 3]
 def test_insert_front_full_list(self):
     mylist = LinkedList()
     mylist.add(2)
     mylist.add(3)
     mylist.add(4)
     mylist.insert(0, 1)
     assert mylist.toList() == [1, 4, 3, 2]
     assert mylist.size() == 4
 def test_clear(self):
     mylist = LinkedList()
     mylist.add(1)
     mylist.add(2)
     mylist.add(3)
     mylist.clear()
     assert mylist.size() == 0
     assert mylist.isEmpty()
     assert mylist.toList() == []
 def test_insert_back_full_list(self):
     mylist = LinkedList()
     mylist.add(2)
     mylist.add(3)
     mylist.add(4)
     mylist.add(5)
     mylist.insert(-3, 1)
     assert mylist.toList() == [5, 1, 4, 3, 2]
     assert mylist.size() == 5
 def test_insert_middle_full_list(self):
     mylist = LinkedList()
     mylist.add(1)
     mylist.add(2)
     mylist.add(3)
     mylist.add(4)
     mylist.insert(2, 17)
     mylist.reverse()
     mylist.reverse()
     assert mylist.toList() == [4, 3, 17, 2, 1]
     assert mylist.size() == 5
 def test_index_high(self):
     mylist = LinkedList()
     mylist.add(2)
     mylist.insert(100, 1)
     assert mylist.toList() == [2, 1]
     assert mylist.size() == 2
 def test_index_low(self):
     mylist = LinkedList()
     mylist.add(2)
     mylist.insert(-100, 1)
     assert mylist.toList() == [1, 2]
     assert mylist.size() == 2
 def test_reverse_empty(self):
     mylist = LinkedList()
     mylist.reverse()
     assert mylist.toList() == []
 def test_toList(self):
     mylist = LinkedList()
     mylist.add(1)
     mylist.add(2)
     mylist.add(3)
     assert mylist.toList() == [3, 2, 1]
 def test_insert_back_one(self):
     mylist = LinkedList()
     mylist.add(2)
     mylist.insert(-1, 1)
     assert mylist.toList() == [1, 2]
     assert mylist.size() == 2
 def test_insert_back_empty(self):
     mylist = LinkedList()
     mylist.insert(-1, 1)
     assert mylist.toList() == [1]
     assert mylist.size() == 1
 def test_insert_front_empty(self):
     mylist = LinkedList()
     mylist.insert(0, 1)
     assert mylist.toList() == [1]
     assert mylist.size() == 1