def test_size_new_nodes_are_head(self):
     ul = UnorderedList()
     ul.add(Node('first'))
     self.assertEqual(ul.head.data, 'first')
     ul.add(Node('second'))
     self.assertEqual(ul.head.data, 'second')
     self.assertEqual(ul.head.next.data, 'first')
 def test_second_node_addition_moves_head(self):
     ul = UnorderedList()
     ul.add(Node('first'))
     first_head = ul.head
     ul.add(Node('second'))
     second_head = ul.head
     self.assertNotEqual(first_head, second_head)
 def test_remove(self):
     ul = UnorderedList()
     ul.add(Node('first'))
     ul.add(Node('second'))
     ul.add(Node('third'))
     self.assertEqual(ul.head.next.data, 'second')
     ul.remove('second')
     self.assertEqual(ul.head.next.data, 'first')
 def test_search_works_with_zero_to_multiple(self):
     ul = UnorderedList()
     self.assertEqual(ul.search('first'), None)
     first_node = Node('first')
     ul.add(first_node)
     self.assertEqual(ul.search('first'), first_node)
     second_first = Node('first')
     ul.add(second_first)
     self.assertEqual(ul.search('first'), second_first)
 def test_size_returns_correct_qty(self):
     ul = UnorderedList()
     ul.add(Node('first'))
     self.assertEqual(ul.size(), 1)
     ul.add(Node('second'))
     self.assertEqual(ul.size(), 2)
 def test_addition_of_first_node(self):
     ul = UnorderedList()
     ul.add(Node('first'))
     self.assertEqual(ul.head.data, 'first')
 def test_empty_ul_method_returns_true(self):
     ul = UnorderedList()
     self.assertEqual(ul.is_empty(), True)