Skip to content

#273: Remove nose dependency for math_probability/ #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions math_probability/add_digits/add_digits_challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"class Solution(object):\n",
Expand All @@ -105,24 +103,22 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# %load test_add_digits.py\n",
"from nose.tools import assert_equal, assert_raises\n",
"import unittest\n",
"\n",
"\n",
"class TestAddDigits(object):\n",
"class TestAddDigits(unittest.TestCase):\n",
"\n",
" def test_add_digits(self, func):\n",
" assert_raises(TypeError, func, None)\n",
" assert_raises(ValueError, func, -1)\n",
" assert_equal(func(0), 0)\n",
" assert_equal(func(9), 9)\n",
" assert_equal(func(138), 3)\n",
" assert_equal(func(65536), 7) \n",
" self.assertRaises(TypeError, func, None)\n",
" self.assertRaises(ValueError, func, -1)\n",
" self.assertEqual(func(0), 0)\n",
" self.assertEqual(func(9), 9)\n",
" self.assertEqual(func(138), 3)\n",
" self.assertEqual(func(65536), 7) \n",
" print('Success: test_add_digits')\n",
"\n",
"\n",
Expand Down Expand Up @@ -168,9 +164,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
}
32 changes: 13 additions & 19 deletions math_probability/add_digits/add_digits_solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"class Solution(object):\n",
Expand Down Expand Up @@ -134,9 +132,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand All @@ -148,18 +144,18 @@
],
"source": [
"%%writefile test_add_digits.py\n",
"from nose.tools import assert_equal, assert_raises\n",
"import unittest\n",
"\n",
"\n",
"class TestAddDigits(object):\n",
"class TestAddDigits(unittest.TestCase):\n",
"\n",
" def test_add_digits(self, func):\n",
" assert_raises(TypeError, func, None)\n",
" assert_raises(ValueError, func, -1)\n",
" assert_equal(func(0), 0)\n",
" assert_equal(func(9), 9)\n",
" assert_equal(func(138), 3)\n",
" assert_equal(func(65536), 7) \n",
" self.assertRaises(TypeError, func, None)\n",
" self.assertRaises(ValueError, func, -1)\n",
" self.assertEqual(func(0), 0)\n",
" self.assertEqual(func(9), 9)\n",
" self.assertEqual(func(138), 3)\n",
" self.assertEqual(func(65536), 7) \n",
" print('Success: test_add_digits')\n",
"\n",
"\n",
Expand All @@ -182,9 +178,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -216,9 +210,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
}
18 changes: 9 additions & 9 deletions math_probability/add_digits/test_add_digits.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from nose.tools import assert_equal, assert_raises
import unittest


class TestAddDigits(object):
class TestAddDigits(unittest.TestCase):

def test_add_digits(self, func):
assert_raises(TypeError, func, None)
assert_raises(ValueError, func, -1)
assert_equal(func(0), 0)
assert_equal(func(9), 9)
assert_equal(func(138), 3)
assert_equal(func(65536), 7)
self.assertRaises(TypeError, func, None)
self.assertRaises(ValueError, func, -1)
self.assertEqual(func(0), 0)
self.assertEqual(func(9), 9)
self.assertEqual(func(138), 3)
self.assertEqual(func(65536), 7)
print('Success: test_add_digits')


Expand All @@ -26,4 +26,4 @@ def main():


if __name__ == '__main__':
main()
main()
26 changes: 11 additions & 15 deletions math_probability/check_prime/check_prime_challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"class Math(object):\n",
Expand All @@ -102,24 +100,22 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# %load 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",
Expand Down Expand Up @@ -158,9 +154,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
}
30 changes: 12 additions & 18 deletions math_probability/check_prime/check_prime_solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import math\n",
Expand Down Expand Up @@ -125,9 +123,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand All @@ -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",
Expand All @@ -166,9 +162,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -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
}
16 changes: 8 additions & 8 deletions math_probability/check_prime/test_check_prime.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from nose.tools import assert_equal, assert_raises
import unittest


class TestMath(object):
class TestMath(unittest.TestCase):

def test_check_prime(self):
math = Math()
assert_raises(TypeError, math.check_prime, None)
assert_raises(TypeError, math.check_prime, 98.6)
assert_equal(math.check_prime(0), False)
assert_equal(math.check_prime(1), False)
assert_equal(math.check_prime(97), True)
self.assertRaises(TypeError, math.check_prime, None)
self.assertRaises(TypeError, math.check_prime, 98.6)
self.assertEqual(math.check_prime(0), False)
self.assertEqual(math.check_prime(1), False)
self.assertEqual(math.check_prime(97), True)
print('Success: test_check_prime')


Expand All @@ -19,4 +19,4 @@ def main():


if __name__ == '__main__':
main()
main()
22 changes: 9 additions & 13 deletions math_probability/generate_primes/check_prime_challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"class PrimeGenerator(object):\n",
Expand All @@ -101,22 +99,20 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# %load test_generate_primes.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_generate_primes(self):\n",
" prime_generator = PrimeGenerator()\n",
" assert_raises(TypeError, prime_generator.generate_primes, None)\n",
" assert_raises(TypeError, prime_generator.generate_primes, 98.6)\n",
" assert_equal(prime_generator.generate_primes(20), [False, False, True, \n",
" self.assertRaises(TypeError, prime_generator.generate_primes, None)\n",
" self.assertRaises(TypeError, prime_generator.generate_primes, 98.6)\n",
" self.assertEqual(prime_generator.generate_primes(20), [False, False, True, \n",
" True, False, True, \n",
" False, True, False, \n",
" False, False, True, \n",
Expand Down Expand Up @@ -161,9 +157,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
}
Loading