def test_remove_same(self): head = ListNode.build_linked_list([1, 1, 1]) self.assertIsNone(self.solution.remove_elements(head, 1))
def test_remove_no_element(self): head = ListNode.build_linked_list([1, 2, 3, 4]) self.assertEqual(self.solution.remove_elements(head, 5), head)
def test_remove_tail(self): head = ListNode.build_linked_list([1, 2, 3, 4]) expect = ListNode.build_linked_list([1, 2, 3]) self.assertEqual(self.solution.remove_elements(head, 4), expect)
def test_remove_multiple(self): head = ListNode.build_linked_list([1, 2, 6, 3, 4, 5, 6]) expect = ListNode.build_linked_list([1, 2, 3, 4, 5]) self.assertEqual(self.solution.remove_elements(head, 6), expect)