mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-08 10:28:03 +00:00
@@ -116,9 +116,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class StringCompare(object):\n",
|
||||
@@ -169,9 +167,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -183,19 +179,19 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_longest_common_subseq.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestLongestCommonSubseq(object):\n",
|
||||
"class TestLongestCommonSubseq(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_longest_common_subseq(self):\n",
|
||||
" str_comp = StringCompare()\n",
|
||||
" assert_raises(TypeError, str_comp.longest_common_subseq, None, None)\n",
|
||||
" assert_equal(str_comp.longest_common_subseq('', ''), '')\n",
|
||||
" self.assertRaises(TypeError, str_comp.longest_common_subseq, None, None)\n",
|
||||
" self.assertEqual(str_comp.longest_common_subseq('', ''), '')\n",
|
||||
" str0 = 'ABCDEFGHIJ'\n",
|
||||
" str1 = 'FOOBCDBCDE'\n",
|
||||
" expected = 'BCDE'\n",
|
||||
" assert_equal(str_comp.longest_common_subseq(str0, str1), expected)\n",
|
||||
" self.assertEqual(str_comp.longest_common_subseq(str0, str1), expected)\n",
|
||||
" print('Success: test_longest_common_subseq')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -211,9 +207,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -244,9 +238,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user