mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 08:58:02 +00:00
@@ -87,9 +87,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class MatrixMultiplicationCost(object):\n",
|
||||
@@ -116,27 +114,25 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_find_min_cost.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestMatrixMultiplicationCost(object):\n",
|
||||
"class TestMatrixMultiplicationCost(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_find_min_cost(self):\n",
|
||||
" matrix_mult_cost = MatrixMultiplicationCost()\n",
|
||||
" assert_raises(TypeError, matrix_mult_cost.find_min_cost, None)\n",
|
||||
" assert_equal(matrix_mult_cost.find_min_cost([]), 0)\n",
|
||||
" self.assertRaises(TypeError, matrix_mult_cost.find_min_cost, None)\n",
|
||||
" self.assertEqual(matrix_mult_cost.find_min_cost([]), 0)\n",
|
||||
" matrices = [Matrix(2, 3),\n",
|
||||
" Matrix(3, 6),\n",
|
||||
" Matrix(6, 4),\n",
|
||||
" Matrix(4, 5)]\n",
|
||||
" expected_cost = 124\n",
|
||||
" assert_equal(matrix_mult_cost.find_min_cost(matrices), expected_cost)\n",
|
||||
" self.assertEqual(matrix_mult_cost.find_min_cost(matrices), expected_cost)\n",
|
||||
" print('Success: test_find_min_cost')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -175,9 +171,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