mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 19:08:02 +00:00
@@ -78,9 +78,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Solution(object):\n",
|
||||
@@ -107,24 +105,22 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_ransom_note.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestRansomNote(object):\n",
|
||||
"class TestRansomNote(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_ransom_note(self):\n",
|
||||
" solution = Solution()\n",
|
||||
" assert_raises(TypeError, solution.match_note_to_magazine, None, None)\n",
|
||||
" assert_equal(solution.match_note_to_magazine('', ''), True)\n",
|
||||
" assert_equal(solution.match_note_to_magazine('a', 'b'), False)\n",
|
||||
" assert_equal(solution.match_note_to_magazine('aa', 'ab'), False)\n",
|
||||
" assert_equal(solution.match_note_to_magazine('aa', 'aab'), True)\n",
|
||||
" self.assertRaises(TypeError, solution.match_note_to_magazine, None, None)\n",
|
||||
" self.assertEqual(solution.match_note_to_magazine('', ''), True)\n",
|
||||
" self.assertEqual(solution.match_note_to_magazine('a', 'b'), False)\n",
|
||||
" self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False)\n",
|
||||
" self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True)\n",
|
||||
" print('Success: test_ransom_note')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -163,9 +159,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