      "collapsed": false
     },
     "outputs": [],
     "source": [
      "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()"
     ]
    }
   ],
   "metadata": {
    "kernelspec": {
 
</s> remove     "* X invalid\n",
 </s> add  </s> remove    "outputs": [],
 </s> add    "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test: Empty list\n",
      "Test: One element list, left list empty\n",
      "Test: Right list is empty\n",
      "Test: General case\n",
      "Success: test_partition\n"
     ]
    }
   ], </s> remove    "execution_count": null,
 </s> add    "execution_count": 3, </s> remove    "execution_count": null,
 </s> add    "execution_count": 1,
    "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()"
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
    "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()"
     ]
    }
   ],
   "metadata": {
    "kernelspec": {
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Reworked notebook: Added more detail to constraints and test cases.  Reworked code and unit test. 
linked-lists/partition.ipynb