mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 08:58:02 +00:00
@@ -84,9 +84,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import math\n",
|
||||
@@ -125,9 +123,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -139,18 +135,18 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_check_prime.py\n",
|
||||
"from nose.tools import assert_equal, assert_raises\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestMath(object):\n",
|
||||
"class TestMath(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_check_prime(self):\n",
|
||||
" math = Math()\n",
|
||||
" assert_raises(TypeError, math.check_prime, None)\n",
|
||||
" assert_raises(TypeError, math.check_prime, 98.6)\n",
|
||||
" assert_equal(math.check_prime(0), False)\n",
|
||||
" assert_equal(math.check_prime(1), False)\n",
|
||||
" assert_equal(math.check_prime(97), True)\n",
|
||||
" self.assertRaises(TypeError, math.check_prime, None)\n",
|
||||
" self.assertRaises(TypeError, math.check_prime, 98.6)\n",
|
||||
" self.assertEqual(math.check_prime(0), False)\n",
|
||||
" self.assertEqual(math.check_prime(1), False)\n",
|
||||
" self.assertEqual(math.check_prime(97), True)\n",
|
||||
" print('Success: test_check_prime')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -166,9 +162,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -199,9 +193,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