From b0a42468f165bddfb57d342807bb7078f9b8efb3 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Mon, 29 Jun 2015 20:36:26 -0400 Subject: [PATCH] Updated Algorithm section and expanded the Unit Test section. --- .../rotation/rotation_challenge.ipynb | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/arrays_strings/rotation/rotation_challenge.ipynb b/arrays_strings/rotation/rotation_challenge.ipynb index 5fa026b..cd9661c 100644 --- a/arrays_strings/rotation/rotation_challenge.ipynb +++ b/arrays_strings/rotation/rotation_challenge.ipynb @@ -56,7 +56,7 @@ "source": [ "## Algorithm\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": [], "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()" ] } ],