mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-08 18:38:03 +00:00
Updated Algorithm section and expanded the Unit Test section.
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## Algorithm\n",
|
"## Algorithm\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Refer to the solution notebook for the algorithm."
|
"Refer to the solution notebook. If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,26 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"%load test_rotation.py"
|
"# %load test_rotation.py\n",
|
||||||
|
"from nose.tools import assert_equal\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"class TestRotation(object):\n",
|
||||||
|
" \n",
|
||||||
|
" def test_rotation(self):\n",
|
||||||
|
" assert_equal(is_rotation('o', 'oo'), False)\n",
|
||||||
|
" assert_equal(is_rotation(None, 'foo'), False)\n",
|
||||||
|
" assert_equal(is_rotation('', 'foo'), False)\n",
|
||||||
|
" assert_equal(is_rotation('', ''), True)\n",
|
||||||
|
" assert_equal(is_rotation('foobarbaz', 'barbazfoo'), True)\n",
|
||||||
|
" print('Success: test_rotation')\n",
|
||||||
|
"\n",
|
||||||
|
"def main():\n",
|
||||||
|
" test = TestRotation()\n",
|
||||||
|
" test.test_rotation()\n",
|
||||||
|
"\n",
|
||||||
|
"if __name__ == '__main__':\n",
|
||||||
|
" main()"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user