mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 08:58:02 +00:00
@@ -83,9 +83,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class StringCompare(object):\n",
|
||||
@@ -112,25 +110,23 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_longest_common_substr.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestLongestCommonSubstr(object):\n",
|
||||
"class TestLongestCommonSubstr(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_longest_common_substr(self):\n",
|
||||
" str_comp = StringCompare()\n",
|
||||
" assert_raises(TypeError, str_comp.longest_common_substr, None, None)\n",
|
||||
" assert_equal(str_comp.longest_common_substr('', ''), '')\n",
|
||||
" self.assertRaises(TypeError, str_comp.longest_common_substr, None, None)\n",
|
||||
" self.assertEqual(str_comp.longest_common_substr('', ''), '')\n",
|
||||
" str0 = 'ABCDEFGHIJ'\n",
|
||||
" str1 = 'FOOBCDBCDE'\n",
|
||||
" expected = 'BCDE'\n",
|
||||
" assert_equal(str_comp.longest_common_substr(str0, str1), expected)\n",
|
||||
" self.assertEqual(str_comp.longest_common_substr(str0, str1), expected)\n",
|
||||
" print('Success: test_longest_common_substr')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -169,9 +165,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user