mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-06 01:18:02 +00:00
Updated Unit Test to include function call (reverse_words) in testReverseWords
This commit is contained in:
@@ -78,9 +78,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 21,
|
"execution_count": 21,
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"collapsed": false
|
|
||||||
},
|
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def reverse_words (S):\n",
|
"def reverse_words (S):\n",
|
||||||
@@ -99,24 +97,22 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 1,
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"collapsed": false
|
|
||||||
},
|
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from nose.tools import assert_equal\n",
|
"from nose.tools import assert_equal\n",
|
||||||
"\n",
|
"\n",
|
||||||
"class UnitTest (object):\n",
|
"class UnitTest (object):\n",
|
||||||
" def testReverseWords(self):\n",
|
" def testReverseWords(self):\n",
|
||||||
" assert_equal(reverse_words('the sun is hot'), 'eht nus si toh')\n",
|
" assert_equal(func('the sun is hot'), 'eht nus si toh')\n",
|
||||||
" assert_equal(reverse_words(''), None)\n",
|
" assert_equal(func(''), None)\n",
|
||||||
" assert_equal(reverse_words('123 456 789'), '321 654 987')\n",
|
" assert_equal(func('123 456 789'), '321 654 987')\n",
|
||||||
" assert_equal(reverse_words('magic'), 'cigam')\n",
|
" assert_equal(func('magic'), 'cigam')\n",
|
||||||
" print('Success: reverse_words')\n",
|
" print('Success: reverse_words')\n",
|
||||||
" \n",
|
" \n",
|
||||||
"def main():\n",
|
"def main():\n",
|
||||||
" test = UnitTest()\n",
|
" test = UnitTest()\n",
|
||||||
" test.testReverseWords()\n",
|
" test.testReverseWords(reverse_words)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"if __name__==\"__main__\":\n",
|
"if __name__==\"__main__\":\n",
|
||||||
" main()"
|
" main()"
|
||||||
@@ -140,7 +136,7 @@
|
|||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
"name": "ipython",
|
"name": "ipython",
|
||||||
"version": 2
|
"version": 2.0
|
||||||
},
|
},
|
||||||
"file_extension": ".py",
|
"file_extension": ".py",
|
||||||
"mimetype": "text/x-python",
|
"mimetype": "text/x-python",
|
||||||
|
|||||||
Reference in New Issue
Block a user