mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 00:48:03 +00:00
@@ -1,13 +1,13 @@
|
||||
from nose.tools import assert_equal
|
||||
import unittest
|
||||
|
||||
|
||||
class TestUtopianTree(object):
|
||||
class TestUtopianTree(unittest.TestCase):
|
||||
|
||||
def test_utopian_tree(self):
|
||||
solution = Solution()
|
||||
assert_equal(solution.calc_utopian_tree_height(0), 1)
|
||||
assert_equal(solution.calc_utopian_tree_height(1), 2)
|
||||
assert_equal(solution.calc_utopian_tree_height(4), 7)
|
||||
self.assertEqual(solution.calc_utopian_tree_height(0), 1)
|
||||
self.assertEqual(solution.calc_utopian_tree_height(1), 2)
|
||||
self.assertEqual(solution.calc_utopian_tree_height(4), 7)
|
||||
print('Success: test_utopian_tree')
|
||||
|
||||
|
||||
@@ -17,4 +17,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
||||
@@ -67,9 +67,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Solution(object):\n",
|
||||
@@ -91,22 +89,20 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_utopian_tree.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestUtopianTree(object):\n",
|
||||
"class TestUtopianTree(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_utopian_tree(self):\n",
|
||||
" solution = Solution()\n",
|
||||
" assert_equal(solution.calc_utopian_tree_height(0), 1)\n",
|
||||
" assert_equal(solution.calc_utopian_tree_height(1), 2)\n",
|
||||
" assert_equal(solution.calc_utopian_tree_height(4), 7)\n",
|
||||
" self.assertEqual(solution.calc_utopian_tree_height(0), 1)\n",
|
||||
" self.assertEqual(solution.calc_utopian_tree_height(1), 2)\n",
|
||||
" self.assertEqual(solution.calc_utopian_tree_height(4), 7)\n",
|
||||
" print('Success: test_utopian_tree')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -145,9 +141,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
|
||||
}
|
||||
|
||||
@@ -74,9 +74,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Solution(object):\n",
|
||||
@@ -104,9 +102,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -118,16 +114,16 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_utopian_tree.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestUtopianTree(object):\n",
|
||||
"class TestUtopianTree(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_utopian_tree(self):\n",
|
||||
" solution = Solution()\n",
|
||||
" assert_equal(solution.calc_utopian_tree_height(0), 1)\n",
|
||||
" assert_equal(solution.calc_utopian_tree_height(1), 2)\n",
|
||||
" assert_equal(solution.calc_utopian_tree_height(4), 7)\n",
|
||||
" self.assertEqual(solution.calc_utopian_tree_height(0), 1)\n",
|
||||
" self.assertEqual(solution.calc_utopian_tree_height(1), 2)\n",
|
||||
" self.assertEqual(solution.calc_utopian_tree_height(4), 7)\n",
|
||||
" print('Success: test_utopian_tree')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -143,9 +139,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -176,9 +170,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