mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 01:48:02 +00:00
@@ -83,9 +83,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Solution(object):\n",
|
||||
@@ -112,23 +110,21 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_max_profit.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestMaxProfit(object):\n",
|
||||
"class TestMaxProfit(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_max_profit(self):\n",
|
||||
" solution = Solution()\n",
|
||||
" assert_raises(TypeError, solution.find_max_profit, None)\n",
|
||||
" assert_raises(ValueError, solution.find_max_profit, [])\n",
|
||||
" assert_equal(solution.find_max_profit([8, 5, 3, 2, 1]), -1)\n",
|
||||
" assert_equal(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)\n",
|
||||
" self.assertRaises(TypeError, solution.find_max_profit, None)\n",
|
||||
" self.assertRaises(ValueError, solution.find_max_profit, [])\n",
|
||||
" self.assertEqual(solution.find_max_profit([8, 5, 3, 2, 1]), -1)\n",
|
||||
" self.assertEqual(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)\n",
|
||||
" print('Success: test_max_profit')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -167,9 +163,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