From 2fd239fbeb7823409425f209018995b5453116d2 Mon Sep 17 00:00:00 2001 From: kmt Date: Wed, 20 Jan 2016 21:40:10 +0300 Subject: [PATCH] Test for inplace modification of the array. --- .../reverse_string/reverse_string_challenge.ipynb | 7 +++++++ arrays_strings/reverse_string/test_reverse_string.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/arrays_strings/reverse_string/reverse_string_challenge.ipynb b/arrays_strings/reverse_string/reverse_string_challenge.ipynb index 499a0de..5fb4f89 100644 --- a/arrays_strings/reverse_string/reverse_string_challenge.ipynb +++ b/arrays_strings/reverse_string/reverse_string_challenge.ipynb @@ -121,10 +121,17 @@ " ['r', 'a', 'b', ' ', 'o', 'o', 'f'])\n", " print('Success: test_reverse')\n", "\n", + " def test_reverse_inplace(self):\n", + " target_list = ['f', 'o', 'o', ' ', 'b', 'a', 'r']\n", + " list_of_chars(target_list)\n", + " assert_equal(target_list, ['r', 'a', 'b', ' ', 'o', 'o', 'f'])\n", + " print('Success: test_reverse_inplace')\n", + "\n", "\n", "def main():\n", " test = TestReverse()\n", " test.test_reverse()\n", + " test.test_reverse_inplace()\n", "\n", "\n", "if __name__ == '__main__':\n", diff --git a/arrays_strings/reverse_string/test_reverse_string.py b/arrays_strings/reverse_string/test_reverse_string.py index 688bff7..553d5b3 100644 --- a/arrays_strings/reverse_string/test_reverse_string.py +++ b/arrays_strings/reverse_string/test_reverse_string.py @@ -11,10 +11,17 @@ class TestReverse(object): ['r', 'a', 'b', ' ', 'o', 'o', 'f']) print('Success: test_reverse') + def test_reverse_inplace(self): + target_list = ['f', 'o', 'o', ' ', 'b', 'a', 'r'] + list_of_chars(target_list) + assert_equal(target_list, ['r', 'a', 'b', ' ', 'o', 'o', 'f']) + print('Success: test_reverse_inplace') + def main(): test = TestReverse() test.test_reverse() + test.test_reverse_inplace() if __name__ == '__main__':