mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 01:48:02 +00:00
@@ -118,9 +118,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Solution(object):\n",
|
||||
@@ -153,9 +151,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -167,19 +163,19 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_assign_cookie.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestAssignCookie(object):\n",
|
||||
"class TestAssignCookie(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_assign_cookie(self):\n",
|
||||
" solution = Solution()\n",
|
||||
" assert_raises(TypeError, solution.find_content_children, None, None)\n",
|
||||
" assert_equal(solution.find_content_children([1, 2, 3], \n",
|
||||
" self.assertRaises(TypeError, solution.find_content_children, None, None)\n",
|
||||
" self.assertEqual(solution.find_content_children([1, 2, 3], \n",
|
||||
" [1, 1]), 1)\n",
|
||||
" assert_equal(solution.find_content_children([1, 2], \n",
|
||||
" self.assertEqual(solution.find_content_children([1, 2], \n",
|
||||
" [1, 2, 3]), 2)\n",
|
||||
" assert_equal(solution.find_content_children([7, 8, 9, 10], \n",
|
||||
" self.assertEqual(solution.find_content_children([7, 8, 9, 10], \n",
|
||||
" [5, 6, 7, 8]), 2)\n",
|
||||
" print('Success: test_find_content_children')\n",
|
||||
"\n",
|
||||
@@ -196,9 +192,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -229,9 +223,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