mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-08 02:18:03 +00:00
@@ -82,9 +82,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Solution(object):\n",
|
||||
@@ -115,20 +113,18 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_math_ops.py\n",
|
||||
"from nose.tools import assert_equal, assert_true, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestMathOps(object):\n",
|
||||
"class TestMathOps(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_math_ops(self):\n",
|
||||
" solution = Solution()\n",
|
||||
" assert_raises(TypeError, solution.insert, None)\n",
|
||||
" self.assertRaises(TypeError, solution.insert, None)\n",
|
||||
" solution.insert(5)\n",
|
||||
" solution.insert(2)\n",
|
||||
" solution.insert(7)\n",
|
||||
@@ -140,10 +136,10 @@
|
||||
" solution.insert(3)\n",
|
||||
" solution.insert(3)\n",
|
||||
" solution.insert(2)\n",
|
||||
" assert_equal(solution.max, 9)\n",
|
||||
" assert_equal(solution.min, 2)\n",
|
||||
" assert_equal(solution.mean, 5)\n",
|
||||
" assert_true(solution.mode in (2, 92))\n",
|
||||
" self.assertEqual(solution.max, 9)\n",
|
||||
" self.assertEqual(solution.min, 2)\n",
|
||||
" self.assertEqual(solution.mean, 5)\n",
|
||||
" self.assertTrue(solution.mode in (2, 92))\n",
|
||||
" print('Success: test_math_ops')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -182,9 +178,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