      "        left = MyLinkedList(None)\n",
      "        right = MyLinkedList(None)\n",
      "        curr = self.head\n",
      "        while curr is not None:\n",
      "            if curr.data < data:\n",
      "                left.append(curr.data)\n",
      "            else:\n",
      "                right.append(curr.data)\n",
      "            curr = curr.next\n",
 
</s> remove     "        if type(data) != int:\n",
    "            raise ValueError('Invalid int argument: data')\n",
 </s> add  </s> remove     "print('Empty list')\n",
    "linked_list = MyLinkedList(None)\n",
    "linked_list.partition(10)\n",
    "linked_list.print_list()\n",
    "print('X invalid')\n",
    "head = Node(12)\n",
    "linked_list = MyLinkedList(head)\n",
    "try:\n",
    "    linked_list.partition('a')\n",
    "except ValueError as err:\n",
    "    print(err)\n",
    "linked_list.print_list()\n",
    "print('One element list')\n",
    "print('Left linked list is empty')\n",
    "linked_list.partition(1)\n",
    "linked_list.print_list()\n",
    "print('Right linked list is empty')\n",
    "linked_list.partition(20)\n",
    "linked_list.print_list()\n",
    "print('General case')\n",
    "# Partition = 10\n",
    "# Input  4, 3, 7, 8, 10, 1, 10, 12\n",
    "# Output 4, 3, 7, 8, 1, 10, 10, 12\n",
    "linked_list.insert_to_front(10)\n",
    "linked_list.insert_to_front(1)\n",
    "linked_list.insert_to_front(10)\n",
    "linked_list.insert_to_front(8)\n",
    "linked_list.insert_to_front(7)\n",
    "linked_list.insert_to_front(3)\n",
    "linked_list.insert_to_front(4)\n",
    "partitioned_list = linked_list.partition(10)\n",
    "partitioned_list.print_list()"
 </s> add     "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    def test_partition(self):\n",
    "        print('Test: Empty list')\n",
    "        linked_list = MyLinkedList(None)\n",
    "        linked_list.partition(10)\n",
    "        assert_equal(linked_list.get_all_data(), [])\n",
    "\n",
    "        print('Test: One element list, left list empty')\n",
    "        linked_list = MyLinkedList(Node(5))\n",
    "        linked_list.partition(0)\n",
    "        assert_equal(linked_list.get_all_data(), [5])\n",
    "\n",
    "        print('Test: Right list is empty')\n",
    "        linked_list = MyLinkedList(Node(5))\n",
    "        linked_list.partition(10)\n",
    "        assert_equal(linked_list.get_all_data(), [5])\n",
    "\n",
    "        print('Test: General case')\n",
    "        # Partition = 10\n",
    "        # Input: 4, 3, 7, 8, 10, 1, 10, 12\n",
    "        # Output: 4, 3, 7, 8, 1, 10, 10, 12\n",
    "        linked_list = MyLinkedList(Node(12))\n",
    "        linked_list.insert_to_front(10)\n",
    "        linked_list.insert_to_front(1)\n",
    "        linked_list.insert_to_front(10)\n",
    "        linked_list.insert_to_front(8)\n",
    "        linked_list.insert_to_front(7)\n",
    "        linked_list.insert_to_front(3)\n",
    "        linked_list.insert_to_front(4)\n",
    "        partitioned_list = linked_list.partition(10)\n",
    "        assert_equal(partitioned_list.get_all_data(), \n",
    "                     [4, 3, 7, 8, 1, 10, 10, 12])\n",
    "        \n",
    "        print('Success: test_partition')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_partition()" </s> remove     "* Test error cases\n",
 </s> add  </s> remove     "* X invalid\n",
 </s> add 
    "        \n",
    "        # Build the left and right lists\n",
      "        left = MyLinkedList(None)\n",
      "        right = MyLinkedList(None)\n",
      "        curr = self.head\n",
    "        \n",
    "        # Build the left and right lists\n",
      "        while curr is not None:\n",
      "            if curr.data < data:\n",
      "                left.append(curr.data)\n",
      "            else:\n",
      "                right.append(curr.data)\n",
      "            curr = curr.next\n",
keep keep add keep keep keep keep keep keep
 Reworked notebook: Added more detail to constraints and test cases.  Reworked code and unit test. 
linked-lists/partition.ipynb