mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Merge branch 'irheart-reverse_string/check-inplace'
* irheart-reverse_string/check-inplace: Add in-place reverse string test to solution notebook. Test for inplace modification of the array.
This commit is contained in:
commit
81f0f0c1af
|
@ -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",
|
||||
|
|
|
@ -170,10 +170,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",
|
||||
|
@ -191,7 +198,8 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Success: test_reverse\n"
|
||||
"Success: test_reverse\n",
|
||||
"Success: test_reverse_inplace\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -281,21 +289,21 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.10"
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
@ -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__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user