mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 02:48:02 +00:00
@@ -91,9 +91,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Sets(object):\n",
|
||||
@@ -124,16 +122,14 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_power_set.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestPowerSet(object):\n",
|
||||
"class TestPowerSet(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_power_set(self):\n",
|
||||
" input_set = []\n",
|
||||
@@ -154,9 +150,9 @@
|
||||
" def run_test(self, input_set, expected):\n",
|
||||
" combinatoric = Combinatoric()\n",
|
||||
" result = combinatoric.find_power_set_recursive(input_set)\n",
|
||||
" assert_equal(result, expected)\n",
|
||||
" self.assertEqual(result, expected)\n",
|
||||
" result = combinatoric.find_power_set_iterative(input_set)\n",
|
||||
" assert_equal(result, expected)\n",
|
||||
" self.assertEqual(result, expected)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
@@ -194,9 +190,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
|
||||
}
|
||||
|
||||
@@ -115,9 +115,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from collections import OrderedDict\n",
|
||||
@@ -171,9 +169,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -185,10 +181,10 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_power_set.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestPowerSet(object):\n",
|
||||
"class TestPowerSet(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_power_set(self):\n",
|
||||
" input_set = ''\n",
|
||||
@@ -214,7 +210,7 @@
|
||||
" def run_test(self, input_set, expected):\n",
|
||||
" combinatoric = Combinatoric()\n",
|
||||
" result = combinatoric.find_power_set(input_set)\n",
|
||||
" assert_equal(result, expected)\n",
|
||||
" self.assertEqual(result, expected)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
@@ -229,9 +225,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -262,9 +256,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
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from nose.tools import assert_equal
|
||||
import unittest
|
||||
|
||||
|
||||
class TestPowerSet(object):
|
||||
class TestPowerSet(unittest.TestCase):
|
||||
|
||||
def test_power_set(self):
|
||||
input_set = ''
|
||||
@@ -27,7 +27,7 @@ class TestPowerSet(object):
|
||||
def run_test(self, input_set, expected):
|
||||
combinatoric = Combinatoric()
|
||||
result = combinatoric.find_power_set(input_set)
|
||||
assert_equal(result, expected)
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -36,4 +36,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user