     "execution_count": null,
     "metadata": {
      "collapsed": false
     },
     "outputs": [],
     "source": [
      "table_size = 10\n",
      "hash_table = HashTable(table_size)\n",
      "print(\"get on an empty hash table index\")\n",
      "print(hash_table.get(0))\n",
 
</s> remove     "table_size = 10\n",
    "hash_table = HashTable(table_size)\n",
    "print(\"get on an empty hash table index\")\n",
    "print(hash_table.get(0))\n",
    "print(\"set on an empty hash table index\")\n",
    "hash_table.set(0, 'foo')\n",
    "print(hash_table.get(0))\n",
    "hash_table.set(1, 'bar')\n",
    "print(hash_table.get(1))\n",
    "print(\"set on a non empty hash table index\")\n",
    "hash_table.set(10, 'foo2')\n",
    "print(hash_table.get(0))\n",
    "print(hash_table.get(10))\n",
    "print(\"set on a key that already exists\")\n",
    "hash_table.set(10, 'foo3')\n",
    "print(hash_table.get(0))\n",
    "print(hash_table.get(10))\n",
    "print(\"remove on a key that already exists\")\n",
    "hash_table.remove(10)\n",
    "print(hash_table.get(0))\n",
    "print(hash_table.get(10))\n",
    "print(\"remove on a key that doesn't exist\")\n",
    "hash_table.remove(-1)"
 </s> add     "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "    \n",
    "    # TODO: It would be better if we had unit tests for each\n",
    "    # HashTable method in addition to the following end-to-end test\n",
    "    def test_end_to_end(self):\n",
    "        hash_table = HashTable(10)\n",
    "        \n",
    "        print(\"Test: get on an empty hash table index\")\n",
    "        assert_equal(hash_table.get(0), None)\n",
    "        \n",
    "        print(\"Test: set on an empty hash table index\")\n",
    "        hash_table.set(0, 'foo')\n",
    "        assert_equal(hash_table.get(0), 'foo')\n",
    "        hash_table.set(1, 'bar')\n",
    "        assert_equal(hash_table.get(1), 'bar')\n",
    "        \n",
    "        print(\"Test: set on a non empty hash table index\")\n",
    "        hash_table.set(10, 'foo2')\n",
    "        assert_equal(hash_table.get(0), 'foo')\n",
    "        assert_equal(hash_table.get(10), 'foo2')\n",
    "        \n",
    "        print(\"Test: set on a key that already exists\")\n",
    "        hash_table.set(10, 'foo3')\n",
    "        assert_equal(hash_table.get(0), 'foo')\n",
    "        assert_equal(hash_table.get(10), 'foo3')\n",
    "        \n",
    "        print(\"Test: remove on a key that already exists\")\n",
    "        hash_table.remove(10)\n",
    "        assert_equal(hash_table.get(0), 'foo')\n",
    "        assert_equal(hash_table.get(10), None)\n",
    "        \n",
    "        print(\"Test: remove on a key that doesn't exist\")\n",
    "        hash_table.remove(-1)\n",
    "        \n",
    "        print('Success: test_end_to_end')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_end_to_end()" </s> remove    "execution_count": null,
 </s> add    "execution_count": 2, </s> remove     "collapsed": true
 </s> add     "collapsed": false </s> remove    "execution_count": null,
 </s> add    "execution_count": 1,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test: get on an empty hash table index\n",
      "Test: set on an empty hash table index\n",
      "Test: set on a non empty hash table index\n",
      "Test: set on a key that already exists\n",
      "Test: remove on a key that already exists\n",
      "Test: remove on a key that doesn't exist\n",
      "Success: test_end_to_end\n"
     ]
    }
   ],
     "execution_count": null,
     "metadata": {
      "collapsed": false
     },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test: get on an empty hash table index\n",
      "Test: set on an empty hash table index\n",
      "Test: set on a non empty hash table index\n",
      "Test: set on a key that already exists\n",
      "Test: remove on a key that already exists\n",
      "Test: remove on a key that doesn't exist\n",
      "Success: test_end_to_end\n"
     ]
    }
   ],
     "source": [
      "table_size = 10\n",
      "hash_table = HashTable(table_size)\n",
      "print(\"get on an empty hash table index\")\n",
      "print(hash_table.get(0))\n",
keep keep keep keep replace keep keep keep keep keep
 Reworked notebook: Added more detail to clarifying questions and test cases.  Reworked unit test. 
arrays-strings/hash-map.ipynb