      "def unique_chars_inplace(string):\n",
      "    for char in string:\n",
      "        if string.count(char) > 1:\n",
      "            return False\n",
      "    return True\n",
      "\n",
      "run_tests(unique_chars_inplace)"
     ]
    }
   ],
 
</s> remove     "run_tests(unique_chars_inplace)"
 </s> add     "class Test(object):\n",
    "  def test_unique_chars(self, func):\n",
    "        assert_equal(func(''), True)\n",
    "        assert_equal(func('foo'), False)\n",
    "        assert_equal(func('bar'), True)\n",
    "        print('Success: test_unique_chars')\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    test = Test()\n",
    "    test.test_unique_chars(unique_chars)\n",
    "    test.test_unique_chars(unique_chars_hash)\n",
    "    test.test_unique_chars(unique_chars_inplace)" </s> remove     "    return True\n",
    "\n",
    "run_tests(unique_chars_hash)"
 </s> add     "    return True" </s> remove     "    return len(set(string)) == len(string)\n",
    "\n",
    "run_tests(unique_chars)"
 </s> add     "    return len(set(string)) == len(string)" </s> remove   {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from nose.tools import assert_equal\n",
    "\n",
    "class Test(object):\n",
    "  def test_unique_chars(self, func):\n",
    "        assert_equal(func(''), True)\n",
    "        assert_equal(func('foo'), False)\n",
    "        assert_equal(func('bar'), True)\n",
    "\n",
    "def run_tests(func):\n",
    "    test = Test()\n",
    "    test.test_unique_chars(func)"
   ]
  },
 </s> add  </s> remove     "* Is the string in ASCII (extended?) or Unicode?  \n",
    "    * ASCII extended, which is 256 characters\n",
 </s> add     "\n",
    "*Problem statements are sometimes intentionally ambiguous.  Asking clarifying questions, identifying constraints, and stating assumptions help to ensure you code the intended solution.*\n",
    "\n",
    "* Can I assume the string is ASCII?\n",
    "    * Yes\n",
    "    * Note: Unicode strings could require special handling depending on your language\n",
    "    return True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Unit Test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Success: test_unique_chars\n",
      "Success: test_unique_chars\n",
      "Success: test_unique_chars\n"
     ]
    }
   ],
   "source": [
    "from nose.tools import assert_equal\n",
      "def unique_chars_inplace(string):\n",
      "    for char in string:\n",
      "        if string.count(char) > 1:\n",
      "            return False\n",
    "    return True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Unit Test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Success: test_unique_chars\n",
      "Success: test_unique_chars\n",
      "Success: test_unique_chars\n"
     ]
    }
   ],
   "source": [
    "from nose.tools import assert_equal\n",
      "\n",
      "run_tests(unique_chars_inplace)"
     ]
    }
   ],
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/unique_chars.ipynb