From 46d3939632175fa9c9caac0bfbaca5b3b7eea521 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Tue, 14 Jul 2020 21:34:08 -0400 Subject: [PATCH] #273: Remove nose dependency for online_judges/ (#282) --- .../assign_cookies_challenge.ipynb | 24 ++++----- .../assign_cookies_solution.ipynb | 28 ++++------ .../assign_cookies/test_assign_cookie.py | 14 ++--- .../busiest_period_challenge.ipynb | 22 ++++---- .../busiest_period_solution.ipynb | 30 ++++------- .../test_find_busiest_period.py | 12 ++--- .../island_perimeter_challenge.ipynb | 22 ++++---- .../island_perimeter_solution.ipynb | 26 ++++------ .../island_perimeter/test_island_perimeter.py | 12 ++--- .../format_license_key_challenge.ipynb | 24 ++++----- .../format_license_key_solution.ipynb | 28 ++++------ .../license_key/test_format_license_key.py | 14 ++--- .../longest_path_challenge.ipynb | 22 ++++---- .../longest_path_solution.ipynb | 26 ++++------ .../test_length_longest_path.py | 12 ++--- .../longest_substr_challenge.ipynb | 24 ++++----- .../longest_substr_solution.ipynb | 28 ++++------ .../test_longest_substr.py | 14 ++--- .../math_ops/math_ops_challenge.ipynb | 26 ++++------ .../math_ops/math_ops_solution.ipynb | 51 +++++++------------ online_judges/math_ops/test_math_ops.py | 16 +++--- .../max_profit/max_profit_challenge.ipynb | 24 ++++----- .../max_profit/max_profit_solution.ipynb | 28 ++++------ online_judges/max_profit/test_max_profit.py | 14 ++--- .../maximizing_xor_challenge.ipynb | 18 +++---- .../maximizing_xor_solution.ipynb | 22 +++----- .../maximizing_xor/test_maximizing_xor.py | 8 +-- .../merge_ranges/merge_ranges_challenge.ipynb | 26 ++++------ .../merge_ranges/merge_ranges_solution.ipynb | 30 +++++------ .../merge_ranges/test_merge_ranges.py | 16 +++--- .../move_zeroes/move_zeroes_challenge.ipynb | 30 +++++------ .../move_zeroes/move_zeroes_solution.ipynb | 34 +++++-------- online_judges/move_zeroes/test_move_zeroes.py | 20 ++++---- .../mult_other_numbers_challenge.ipynb | 26 ++++------ .../mult_other_numbers_solution.ipynb | 30 +++++------ .../test_mult_other_numbers.py | 16 +++--- online_judges/nim/nim_challenge.ipynb | 30 +++++------ online_judges/nim/nim_solution.ipynb | 34 +++++-------- online_judges/nim/test_can_win_nim.py | 20 ++++---- .../prod_three/prod_three_challenge.ipynb | 24 ++++----- .../prod_three/prod_three_solution.ipynb | 28 ++++------ online_judges/prod_three/test_prod_three.py | 14 ++--- .../ransom_note/ransom_note_challenge.ipynb | 26 ++++------ .../ransom_note/ransom_note_solution.ipynb | 30 +++++------ online_judges/ransom_note/test_ransom_note.py | 16 +++--- .../sentence_screen_fit_challenge.ipynb | 26 ++++------ .../sentence_screen_fit_solution.ipynb | 30 +++++------ .../test_count_sentence_fit.py | 16 +++--- .../str_diff/str_diff_challenge.ipynb | 20 +++----- .../str_diff/str_diff_solution.ipynb | 24 ++++----- online_judges/str_diff/test_str_diff.py | 10 ++-- online_judges/sub_two/sub_two_challenge.ipynb | 26 ++++------ online_judges/sub_two/sub_two_solution.ipynb | 27 ++++------ online_judges/sub_two/test_sub_two.py | 16 +++--- online_judges/sum_two/sum_two_challenge.ipynb | 24 ++++----- online_judges/sum_two/sum_two_solution.ipynb | 25 ++++----- online_judges/sum_two/test_sum_two.py | 14 ++--- .../utopian_tree/test_utopian_tree.py | 12 ++--- .../utopian_tree/utopian_tree_challenge.ipynb | 22 ++++---- .../utopian_tree/utopian_tree_solution.ipynb | 26 ++++------ 60 files changed, 575 insertions(+), 782 deletions(-) diff --git a/online_judges/assign_cookies/assign_cookies_challenge.ipynb b/online_judges/assign_cookies/assign_cookies_challenge.ipynb index d4c2649..041d10d 100644 --- a/online_judges/assign_cookies/assign_cookies_challenge.ipynb +++ b/online_judges/assign_cookies/assign_cookies_challenge.ipynb @@ -108,9 +108,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -137,25 +135,23 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_assign_cookie.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestAssignCookie(object):\n", + "class TestAssignCookie(unittest.TestCase):\n", "\n", " def test_assign_cookie(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_content_children, None, None)\n", - " assert_equal(solution.find_content_children([1, 2, 3], \n", + " self.assertRaises(TypeError, solution.find_content_children, None, None)\n", + " self.assertEqual(solution.find_content_children([1, 2, 3], \n", " [1, 1]), 1)\n", - " assert_equal(solution.find_content_children([1, 2], \n", + " self.assertEqual(solution.find_content_children([1, 2], \n", " [1, 2, 3]), 2)\n", - " assert_equal(solution.find_content_children([7, 8, 9, 10], \n", + " self.assertEqual(solution.find_content_children([7, 8, 9, 10], \n", " [5, 6, 7, 8]), 2)\n", " print('Success: test_find_content_children')\n", "\n", @@ -195,9 +191,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 } diff --git a/online_judges/assign_cookies/assign_cookies_solution.ipynb b/online_judges/assign_cookies/assign_cookies_solution.ipynb index a303d47..c460839 100644 --- a/online_judges/assign_cookies/assign_cookies_solution.ipynb +++ b/online_judges/assign_cookies/assign_cookies_solution.ipynb @@ -118,9 +118,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -153,9 +151,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -167,19 +163,19 @@ ], "source": [ "%%writefile test_assign_cookie.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestAssignCookie(object):\n", + "class TestAssignCookie(unittest.TestCase):\n", "\n", " def test_assign_cookie(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_content_children, None, None)\n", - " assert_equal(solution.find_content_children([1, 2, 3], \n", + " self.assertRaises(TypeError, solution.find_content_children, None, None)\n", + " self.assertEqual(solution.find_content_children([1, 2, 3], \n", " [1, 1]), 1)\n", - " assert_equal(solution.find_content_children([1, 2], \n", + " self.assertEqual(solution.find_content_children([1, 2], \n", " [1, 2, 3]), 2)\n", - " assert_equal(solution.find_content_children([7, 8, 9, 10], \n", + " self.assertEqual(solution.find_content_children([7, 8, 9, 10], \n", " [5, 6, 7, 8]), 2)\n", " print('Success: test_find_content_children')\n", "\n", @@ -196,9 +192,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -229,9 +223,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 } diff --git a/online_judges/assign_cookies/test_assign_cookie.py b/online_judges/assign_cookies/test_assign_cookie.py index 625fd74..8d81883 100644 --- a/online_judges/assign_cookies/test_assign_cookie.py +++ b/online_judges/assign_cookies/test_assign_cookie.py @@ -1,16 +1,16 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestAssignCookie(object): +class TestAssignCookie(unittest.TestCase): def test_assign_cookie(self): solution = Solution() - assert_raises(TypeError, solution.find_content_children, None, None) - assert_equal(solution.find_content_children([1, 2, 3], + self.assertRaises(TypeError, solution.find_content_children, None, None) + self.assertEqual(solution.find_content_children([1, 2, 3], [1, 1]), 1) - assert_equal(solution.find_content_children([1, 2], + self.assertEqual(solution.find_content_children([1, 2], [1, 2, 3]), 2) - assert_equal(solution.find_content_children([7, 8, 9, 10], + self.assertEqual(solution.find_content_children([7, 8, 9, 10], [5, 6, 7, 8]), 2) print('Success: test_find_content_children') @@ -21,4 +21,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/busiest_period/busiest_period_challenge.ipynb b/online_judges/busiest_period/busiest_period_challenge.ipynb index 6a0c77c..d0515c6 100644 --- a/online_judges/busiest_period/busiest_period_challenge.ipynb +++ b/online_judges/busiest_period/busiest_period_challenge.ipynb @@ -137,9 +137,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -166,21 +164,19 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_find_busiest_period.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_find_busiest_period(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_busiest_period, None)\n", - " assert_equal(solution.find_busiest_period([]), None)\n", + " self.assertRaises(TypeError, solution.find_busiest_period, None)\n", + " self.assertEqual(solution.find_busiest_period([]), None)\n", " data = [\n", " Data(3, 2, EventType.EXIT),\n", " Data(1, 2, EventType.ENTER),\n", @@ -189,7 +185,7 @@ " Data(9, 2, EventType.EXIT),\n", " Data(8, 2, EventType.EXIT),\n", " ]\n", - " assert_equal(solution.find_busiest_period(data), Period(7, 8))\n", + " self.assertEqual(solution.find_busiest_period(data), Period(7, 8))\n", " print('Success: test_find_busiest_period')\n", "\n", "\n", @@ -228,9 +224,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 } diff --git a/online_judges/busiest_period/busiest_period_solution.ipynb b/online_judges/busiest_period/busiest_period_solution.ipynb index 21fa455..eabbf43 100644 --- a/online_judges/busiest_period/busiest_period_solution.ipynb +++ b/online_judges/busiest_period/busiest_period_solution.ipynb @@ -119,9 +119,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "from enum import Enum\n", @@ -160,9 +158,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -206,9 +202,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -220,15 +214,15 @@ ], "source": [ "%%writefile test_find_busiest_period.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_find_busiest_period(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_busiest_period, None)\n", - " assert_equal(solution.find_busiest_period([]), None)\n", + " self.assertRaises(TypeError, solution.find_busiest_period, None)\n", + " self.assertEqual(solution.find_busiest_period([]), None)\n", " data = [\n", " Data(3, 2, EventType.EXIT),\n", " Data(1, 2, EventType.ENTER),\n", @@ -237,7 +231,7 @@ " Data(9, 2, EventType.EXIT),\n", " Data(8, 2, EventType.EXIT),\n", " ]\n", - " assert_equal(solution.find_busiest_period(data), Period(7, 8))\n", + " self.assertEqual(solution.find_busiest_period(data), Period(7, 8))\n", " print('Success: test_find_busiest_period')\n", "\n", "\n", @@ -253,9 +247,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -286,9 +278,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 } diff --git a/online_judges/busiest_period/test_find_busiest_period.py b/online_judges/busiest_period/test_find_busiest_period.py index f7c4ed0..18913db 100644 --- a/online_judges/busiest_period/test_find_busiest_period.py +++ b/online_judges/busiest_period/test_find_busiest_period.py @@ -1,12 +1,12 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSolution(object): +class TestSolution(unittest.TestCase): def test_find_busiest_period(self): solution = Solution() - assert_raises(TypeError, solution.find_busiest_period, None) - assert_equal(solution.find_busiest_period([]), None) + self.assertRaises(TypeError, solution.find_busiest_period, None) + self.assertEqual(solution.find_busiest_period([]), None) data = [ Data(3, 2, EventType.EXIT), Data(1, 2, EventType.ENTER), @@ -15,7 +15,7 @@ class TestSolution(object): Data(9, 2, EventType.EXIT), Data(8, 2, EventType.EXIT), ] - assert_equal(solution.find_busiest_period(data), Period(7, 8)) + self.assertEqual(solution.find_busiest_period(data), Period(7, 8)) print('Success: test_find_busiest_period') @@ -25,4 +25,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/island_perimeter/island_perimeter_challenge.ipynb b/online_judges/island_perimeter/island_perimeter_challenge.ipynb index d16d5f7..6d2576e 100644 --- a/online_judges/island_perimeter/island_perimeter_challenge.ipynb +++ b/online_judges/island_perimeter/island_perimeter_challenge.ipynb @@ -90,9 +90,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -119,29 +117,27 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_island_perimeter.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestIslandPerimeter(object):\n", + "class TestIslandPerimeter(unittest.TestCase):\n", "\n", " def test_island_perimeter(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.island_perimeter, None)\n", + " self.assertRaises(TypeError, solution.island_perimeter, None)\n", " data = [[1, 0]]\n", " expected = 4\n", - " assert_equal(solution.island_perimeter(data), expected)\n", + " self.assertEqual(solution.island_perimeter(data), expected)\n", " data = [[0, 1, 0, 0],\n", " [1, 1, 1, 0],\n", " [0, 1, 0, 0],\n", " [1, 1, 0, 0]]\n", " expected = 16\n", - " assert_equal(solution.island_perimeter(data), expected)\n", + " self.assertEqual(solution.island_perimeter(data), expected)\n", " print('Success: test_island_perimeter')\n", "\n", "\n", @@ -180,9 +176,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 } diff --git a/online_judges/island_perimeter/island_perimeter_solution.ipynb b/online_judges/island_perimeter/island_perimeter_solution.ipynb index 72d4bb5..a1ee281 100644 --- a/online_judges/island_perimeter/island_perimeter_solution.ipynb +++ b/online_judges/island_perimeter/island_perimeter_solution.ipynb @@ -95,9 +95,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -136,9 +134,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -150,23 +146,23 @@ ], "source": [ "%%writefile test_island_perimeter.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestIslandPerimeter(object):\n", + "class TestIslandPerimeter(unittest.TestCase):\n", "\n", " def test_island_perimeter(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.island_perimeter, None)\n", + " self.assertRaises(TypeError, solution.island_perimeter, None)\n", " data = [[1, 0]]\n", " expected = 4\n", - " assert_equal(solution.island_perimeter(data), expected)\n", + " self.assertEqual(solution.island_perimeter(data), expected)\n", " data = [[0, 1, 0, 0],\n", " [1, 1, 1, 0],\n", " [0, 1, 0, 0],\n", " [1, 1, 0, 0]]\n", " expected = 16\n", - " assert_equal(solution.island_perimeter(data), expected)\n", + " self.assertEqual(solution.island_perimeter(data), expected)\n", " print('Success: test_island_perimeter')\n", "\n", "\n", @@ -182,9 +178,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -215,9 +209,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 } diff --git a/online_judges/island_perimeter/test_island_perimeter.py b/online_judges/island_perimeter/test_island_perimeter.py index 95d3a96..54777bb 100644 --- a/online_judges/island_perimeter/test_island_perimeter.py +++ b/online_judges/island_perimeter/test_island_perimeter.py @@ -1,20 +1,20 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestIslandPerimeter(object): +class TestIslandPerimeter(unittest.TestCase): def test_island_perimeter(self): solution = Solution() - assert_raises(TypeError, solution.island_perimeter, None) + self.assertRaises(TypeError, solution.island_perimeter, None) data = [[1, 0]] expected = 4 - assert_equal(solution.island_perimeter(data), expected) + self.assertEqual(solution.island_perimeter(data), expected) data = [[0, 1, 0, 0], [1, 1, 1, 0], [0, 1, 0, 0], [1, 1, 0, 0]] expected = 16 - assert_equal(solution.island_perimeter(data), expected) + self.assertEqual(solution.island_perimeter(data), expected) print('Success: test_island_perimeter') @@ -24,4 +24,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/license_key/format_license_key_challenge.ipynb b/online_judges/license_key/format_license_key_challenge.ipynb index 4a849a0..3431f52 100644 --- a/online_judges/license_key/format_license_key_challenge.ipynb +++ b/online_judges/license_key/format_license_key_challenge.ipynb @@ -102,9 +102,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -131,32 +129,30 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_format_license_key.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_format_license_key(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.format_license_key, None, None)\n", + " self.assertRaises(TypeError, solution.format_license_key, None, None)\n", " license_key = '---'\n", " k = 3\n", " expected = ''\n", - " assert_equal(solution.format_license_key(license_key, k), expected)\n", + " self.assertEqual(solution.format_license_key(license_key, k), expected)\n", " license_key = '2-4A0r7-4k'\n", " k = 3\n", " expected = '24-A0R-74K'\n", - " assert_equal(solution.format_license_key(license_key, k), expected)\n", + " self.assertEqual(solution.format_license_key(license_key, k), expected)\n", " license_key = '2-4A0r7-4k'\n", " k = 4\n", " expected = '24A0-R74K'\n", - " assert_equal(solution.format_license_key(license_key, k), expected)\n", + " self.assertEqual(solution.format_license_key(license_key, k), expected)\n", " print('Success: test_format_license_key')\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 } diff --git a/online_judges/license_key/format_license_key_solution.ipynb b/online_judges/license_key/format_license_key_solution.ipynb index e705025..81d4f1f 100644 --- a/online_judges/license_key/format_license_key_solution.ipynb +++ b/online_judges/license_key/format_license_key_solution.ipynb @@ -110,9 +110,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -147,9 +145,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -161,26 +157,26 @@ ], "source": [ "%%writefile test_format_license_key.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_format_license_key(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.format_license_key, None, None)\n", + " self.assertRaises(TypeError, solution.format_license_key, None, None)\n", " license_key = '---'\n", " k = 3\n", " expected = ''\n", - " assert_equal(solution.format_license_key(license_key, k), expected)\n", + " self.assertEqual(solution.format_license_key(license_key, k), expected)\n", " license_key = '2-4A0r7-4k'\n", " k = 3\n", " expected = '24-A0R-74K'\n", - " assert_equal(solution.format_license_key(license_key, k), expected)\n", + " self.assertEqual(solution.format_license_key(license_key, k), expected)\n", " license_key = '2-4A0r7-4k'\n", " k = 4\n", " expected = '24A0-R74K'\n", - " assert_equal(solution.format_license_key(license_key, k), expected)\n", + " self.assertEqual(solution.format_license_key(license_key, k), expected)\n", " print('Success: test_format_license_key')\n", "\n", "def main():\n", @@ -195,9 +191,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -228,9 +222,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 } diff --git a/online_judges/license_key/test_format_license_key.py b/online_judges/license_key/test_format_license_key.py index 23f8999..c5da93b 100644 --- a/online_judges/license_key/test_format_license_key.py +++ b/online_judges/license_key/test_format_license_key.py @@ -1,23 +1,23 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSolution(object): +class TestSolution(unittest.TestCase): def test_format_license_key(self): solution = Solution() - assert_raises(TypeError, solution.format_license_key, None, None) + self.assertRaises(TypeError, solution.format_license_key, None, None) license_key = '---' k = 3 expected = '' - assert_equal(solution.format_license_key(license_key, k), expected) + self.assertEqual(solution.format_license_key(license_key, k), expected) license_key = '2-4A0r7-4k' k = 3 expected = '24-A0R-74K' - assert_equal(solution.format_license_key(license_key, k), expected) + self.assertEqual(solution.format_license_key(license_key, k), expected) license_key = '2-4A0r7-4k' k = 4 expected = '24A0-R74K' - assert_equal(solution.format_license_key(license_key, k), expected) + self.assertEqual(solution.format_license_key(license_key, k), expected) print('Success: test_format_license_key') def main(): @@ -26,4 +26,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/longest_abs_file_path/longest_path_challenge.ipynb b/online_judges/longest_abs_file_path/longest_path_challenge.ipynb index 07956fc..10f1c71 100644 --- a/online_judges/longest_abs_file_path/longest_path_challenge.ipynb +++ b/online_judges/longest_abs_file_path/longest_path_challenge.ipynb @@ -113,9 +113,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -142,24 +140,22 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_length_longest_path.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_length_longest_path(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.length_longest_path, None)\n", - " assert_equal(solution.length_longest_path(''), 0)\n", + " self.assertRaises(TypeError, solution.length_longest_path, None)\n", + " self.assertEqual(solution.length_longest_path(''), 0)\n", " file_system = 'dir\\n\\tsubdir1\\n\\t\\tfile1.ext\\n\\t\\tsubsubdir1\\n\\tsubdir2\\n\\t\\tsubsubdir2\\n\\t\\t\\tfile2.ext'\n", " expected = 32\n", - " assert_equal(solution.length_longest_path(file_system), expected)\n", + " self.assertEqual(solution.length_longest_path(file_system), expected)\n", " print('Success: test_length_longest_path')\n", "\n", "\n", @@ -198,9 +194,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 } diff --git a/online_judges/longest_abs_file_path/longest_path_solution.ipynb b/online_judges/longest_abs_file_path/longest_path_solution.ipynb index f0d1d81..bc0498d 100644 --- a/online_judges/longest_abs_file_path/longest_path_solution.ipynb +++ b/online_judges/longest_abs_file_path/longest_path_solution.ipynb @@ -128,9 +128,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -160,9 +158,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -174,18 +170,18 @@ ], "source": [ "%%writefile test_length_longest_path.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_length_longest_path(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.length_longest_path, None)\n", - " assert_equal(solution.length_longest_path(''), 0)\n", + " self.assertRaises(TypeError, solution.length_longest_path, None)\n", + " self.assertEqual(solution.length_longest_path(''), 0)\n", " file_system = 'dir\\n\\tsubdir1\\n\\t\\tfile1.ext\\n\\t\\tsubsubdir1\\n\\tsubdir2\\n\\t\\tsubsubdir2\\n\\t\\t\\tfile2.ext'\n", " expected = 32\n", - " assert_equal(solution.length_longest_path(file_system), expected)\n", + " self.assertEqual(solution.length_longest_path(file_system), expected)\n", " print('Success: test_length_longest_path')\n", "\n", "\n", @@ -201,9 +197,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -234,9 +228,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 } diff --git a/online_judges/longest_abs_file_path/test_length_longest_path.py b/online_judges/longest_abs_file_path/test_length_longest_path.py index 6ca9568..2fc8c77 100644 --- a/online_judges/longest_abs_file_path/test_length_longest_path.py +++ b/online_judges/longest_abs_file_path/test_length_longest_path.py @@ -1,15 +1,15 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSolution(object): +class TestSolution(unittest.TestCase): def test_length_longest_path(self): solution = Solution() - assert_raises(TypeError, solution.length_longest_path, None) - assert_equal(solution.length_longest_path(''), 0) + self.assertRaises(TypeError, solution.length_longest_path, None) + self.assertEqual(solution.length_longest_path(''), 0) file_system = 'dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext' expected = 32 - assert_equal(solution.length_longest_path(file_system), expected) + self.assertEqual(solution.length_longest_path(file_system), expected) print('Success: test_length_longest_path') @@ -19,4 +19,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/longest_substr_k_distinct/longest_substr_challenge.ipynb b/online_judges/longest_substr_k_distinct/longest_substr_challenge.ipynb index e0ca5f9..d5975cf 100644 --- a/online_judges/longest_substr_k_distinct/longest_substr_challenge.ipynb +++ b/online_judges/longest_substr_k_distinct/longest_substr_challenge.ipynb @@ -79,9 +79,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -108,23 +106,21 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_longest_substr.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_longest_substr(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.longest_substr, None)\n", - " assert_equal(solution.longest_substr('', k=3), 0)\n", - " assert_equal(solution.longest_substr('abcabcdefgghiij', k=3), 6)\n", - " assert_equal(solution.longest_substr('abcabcdefgghighij', k=3), 7)\n", + " self.assertRaises(TypeError, solution.longest_substr, None)\n", + " self.assertEqual(solution.longest_substr('', k=3), 0)\n", + " self.assertEqual(solution.longest_substr('abcabcdefgghiij', k=3), 6)\n", + " self.assertEqual(solution.longest_substr('abcabcdefgghighij', k=3), 7)\n", " print('Success: test_longest_substr')\n", "\n", "\n", @@ -163,9 +159,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 } diff --git a/online_judges/longest_substr_k_distinct/longest_substr_solution.ipynb b/online_judges/longest_substr_k_distinct/longest_substr_solution.ipynb index 07615b4..63d5cdc 100644 --- a/online_judges/longest_substr_k_distinct/longest_substr_solution.ipynb +++ b/online_judges/longest_substr_k_distinct/longest_substr_solution.ipynb @@ -92,9 +92,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -127,9 +125,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -141,17 +137,17 @@ ], "source": [ "%%writefile test_longest_substr.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_longest_substr(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.longest_substr, None)\n", - " assert_equal(solution.longest_substr('', k=3), 0)\n", - " assert_equal(solution.longest_substr('abcabcdefgghiij', k=3), 6)\n", - " assert_equal(solution.longest_substr('abcabcdefgghighij', k=3), 7)\n", + " self.assertRaises(TypeError, solution.longest_substr, None)\n", + " self.assertEqual(solution.longest_substr('', k=3), 0)\n", + " self.assertEqual(solution.longest_substr('abcabcdefgghiij', k=3), 6)\n", + " self.assertEqual(solution.longest_substr('abcabcdefgghighij', k=3), 7)\n", " print('Success: test_longest_substr')\n", "\n", "\n", @@ -167,9 +163,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -200,9 +194,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 } diff --git a/online_judges/longest_substr_k_distinct/test_longest_substr.py b/online_judges/longest_substr_k_distinct/test_longest_substr.py index 6410c7f..34e9e2a 100644 --- a/online_judges/longest_substr_k_distinct/test_longest_substr.py +++ b/online_judges/longest_substr_k_distinct/test_longest_substr.py @@ -1,14 +1,14 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSolution(object): +class TestSolution(unittest.TestCase): def test_longest_substr(self): solution = Solution() - assert_raises(TypeError, solution.longest_substr, None) - assert_equal(solution.longest_substr('', k=3), 0) - assert_equal(solution.longest_substr('abcabcdefgghiij', k=3), 6) - assert_equal(solution.longest_substr('abcabcdefgghighij', k=3), 7) + self.assertRaises(TypeError, solution.longest_substr, None) + self.assertEqual(solution.longest_substr('', k=3), 0) + self.assertEqual(solution.longest_substr('abcabcdefgghiij', k=3), 6) + self.assertEqual(solution.longest_substr('abcabcdefgghighij', k=3), 7) print('Success: test_longest_substr') @@ -18,4 +18,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/math_ops/math_ops_challenge.ipynb b/online_judges/math_ops/math_ops_challenge.ipynb index bcd19d4..47ce99d 100644 --- a/online_judges/math_ops/math_ops_challenge.ipynb +++ b/online_judges/math_ops/math_ops_challenge.ipynb @@ -82,9 +82,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -115,20 +113,18 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_math_ops.py\n", - "from nose.tools import assert_equal, assert_true, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMathOps(object):\n", + "class TestMathOps(unittest.TestCase):\n", "\n", " def test_math_ops(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.insert, None)\n", + " self.assertRaises(TypeError, solution.insert, None)\n", " solution.insert(5)\n", " solution.insert(2)\n", " solution.insert(7)\n", @@ -140,10 +136,10 @@ " solution.insert(3)\n", " solution.insert(3)\n", " solution.insert(2)\n", - " assert_equal(solution.max, 9)\n", - " assert_equal(solution.min, 2)\n", - " assert_equal(solution.mean, 5)\n", - " assert_true(solution.mode in (2, 92))\n", + " self.assertEqual(solution.max, 9)\n", + " self.assertEqual(solution.min, 2)\n", + " self.assertEqual(solution.mean, 5)\n", + " self.assertTrue(solution.mode in (2, 92))\n", " print('Success: test_math_ops')\n", "\n", "\n", @@ -182,9 +178,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 } diff --git a/online_judges/math_ops/math_ops_solution.ipynb b/online_judges/math_ops/math_ops_solution.ipynb index 801f90c..533e720 100644 --- a/online_judges/math_ops/math_ops_solution.ipynb +++ b/online_judges/math_ops/math_ops_solution.ipynb @@ -84,10 +84,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, + "execution_count": 1, + "metadata": {}, "outputs": [], "source": [ "from __future__ import division\n", @@ -134,10 +132,8 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, + "execution_count": 2, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -149,14 +145,14 @@ ], "source": [ "%%writefile test_math_ops.py\n", - "from nose.tools import assert_equal, assert_true, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMathOps(object):\n", + "class TestMathOps(unittest.TestCase):\n", "\n", " def test_math_ops(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.insert, None)\n", + " self.assertRaises(TypeError, solution.insert, None)\n", " solution.insert(5)\n", " solution.insert(2)\n", " solution.insert(7)\n", @@ -168,10 +164,10 @@ " solution.insert(3)\n", " solution.insert(3)\n", " solution.insert(2)\n", - " assert_equal(solution.max, 9)\n", - " assert_equal(solution.min, 2)\n", - " assert_equal(solution.mean, 5)\n", - " assert_true(solution.mode in (2, 9))\n", + " self.assertEqual(solution.max, 9)\n", + " self.assertEqual(solution.min, 2)\n", + " self.assertEqual(solution.mean, 5)\n", + " self.assertTrue(solution.mode in (2, 9))\n", " print('Success: test_math_ops')\n", "\n", "\n", @@ -186,23 +182,14 @@ }, { "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, + "execution_count": 3, + "metadata": {}, "outputs": [ { - "ename": "AssertionError", - "evalue": "False is not true", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/Users/donnemartin/Dev/github/sources/interactive-coding-challenges/online_judges/math_ops/test_math_ops.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 32\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m__name__\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'__main__'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 33\u001b[0;31m \u001b[0mmain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/Users/donnemartin/Dev/github/sources/interactive-coding-challenges/online_judges/math_ops/test_math_ops.py\u001b[0m in \u001b[0;36mmain\u001b[0;34m()\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0mtest\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mTestMathOps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0mtest\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtest_math_ops\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/Users/donnemartin/Dev/github/sources/interactive-coding-challenges/online_judges/math_ops/test_math_ops.py\u001b[0m in \u001b[0;36mtest_math_ops\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0massert_equal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msolution\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmin\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0massert_equal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msolution\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 23\u001b[0;31m \u001b[0massert_true\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msolution\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m \u001b[0;32min\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m92\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 24\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Success: test_math_ops'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/Users/donnemartin/.pyenv/versions/3.5.0/lib/python3.5/unittest/case.py\u001b[0m in \u001b[0;36massertTrue\u001b[0;34m(self, expr, msg)\u001b[0m\n\u001b[1;32m 672\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mexpr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 673\u001b[0m \u001b[0mmsg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_formatMessage\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"%s is not true\"\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0msafe_repr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 674\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfailureException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 675\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 676\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_formatMessage\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmsg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstandardMsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: False is not true" + "name": "stdout", + "output_type": "stream", + "text": [ + "Success: test_math_ops\n" ] } ], @@ -227,9 +214,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 } diff --git a/online_judges/math_ops/test_math_ops.py b/online_judges/math_ops/test_math_ops.py index b00cabf..4431819 100644 --- a/online_judges/math_ops/test_math_ops.py +++ b/online_judges/math_ops/test_math_ops.py @@ -1,11 +1,11 @@ -from nose.tools import assert_equal, assert_true, assert_raises +import unittest -class TestMathOps(object): +class TestMathOps(unittest.TestCase): def test_math_ops(self): solution = Solution() - assert_raises(TypeError, solution.insert, None) + self.assertRaises(TypeError, solution.insert, None) solution.insert(5) solution.insert(2) solution.insert(7) @@ -17,10 +17,10 @@ class TestMathOps(object): solution.insert(3) solution.insert(3) solution.insert(2) - assert_equal(solution.max, 9) - assert_equal(solution.min, 2) - assert_equal(solution.mean, 5) - assert_true(solution.mode in (2, 92)) + self.assertEqual(solution.max, 9) + self.assertEqual(solution.min, 2) + self.assertEqual(solution.mean, 5) + self.assertTrue(solution.mode in (2, 9)) print('Success: test_math_ops') @@ -30,4 +30,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/max_profit/max_profit_challenge.ipynb b/online_judges/max_profit/max_profit_challenge.ipynb index 3c0e540..ebe95d1 100644 --- a/online_judges/max_profit/max_profit_challenge.ipynb +++ b/online_judges/max_profit/max_profit_challenge.ipynb @@ -83,9 +83,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -112,23 +110,21 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_max_profit.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMaxProfit(object):\n", + "class TestMaxProfit(unittest.TestCase):\n", "\n", " def test_max_profit(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_max_profit, None)\n", - " assert_raises(ValueError, solution.find_max_profit, [])\n", - " assert_equal(solution.find_max_profit([8, 5, 3, 2, 1]), -1)\n", - " assert_equal(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)\n", + " self.assertRaises(TypeError, solution.find_max_profit, None)\n", + " self.assertRaises(ValueError, solution.find_max_profit, [])\n", + " self.assertEqual(solution.find_max_profit([8, 5, 3, 2, 1]), -1)\n", + " self.assertEqual(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)\n", " print('Success: test_max_profit')\n", "\n", "\n", @@ -167,9 +163,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 } diff --git a/online_judges/max_profit/max_profit_solution.ipynb b/online_judges/max_profit/max_profit_solution.ipynb index 6577016..729a36c 100644 --- a/online_judges/max_profit/max_profit_solution.ipynb +++ b/online_judges/max_profit/max_profit_solution.ipynb @@ -90,9 +90,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "import sys\n", @@ -124,9 +122,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -138,17 +134,17 @@ ], "source": [ "%%writefile test_max_profit.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMaxProfit(object):\n", + "class TestMaxProfit(unittest.TestCase):\n", "\n", " def test_max_profit(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_max_profit, None)\n", - " assert_raises(ValueError, solution.find_max_profit, [])\n", - " assert_equal(solution.find_max_profit([8, 5, 3, 2, 1]), -1)\n", - " assert_equal(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)\n", + " self.assertRaises(TypeError, solution.find_max_profit, None)\n", + " self.assertRaises(ValueError, solution.find_max_profit, [])\n", + " self.assertEqual(solution.find_max_profit([8, 5, 3, 2, 1]), -1)\n", + " self.assertEqual(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)\n", " print('Success: test_max_profit')\n", "\n", "\n", @@ -164,9 +160,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -197,9 +191,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 } diff --git a/online_judges/max_profit/test_max_profit.py b/online_judges/max_profit/test_max_profit.py index 26e9b12..040906f 100644 --- a/online_judges/max_profit/test_max_profit.py +++ b/online_judges/max_profit/test_max_profit.py @@ -1,14 +1,14 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestMaxProfit(object): +class TestMaxProfit(unittest.TestCase): def test_max_profit(self): solution = Solution() - assert_raises(TypeError, solution.find_max_profit, None) - assert_raises(ValueError, solution.find_max_profit, []) - assert_equal(solution.find_max_profit([8, 5, 3, 2, 1]), -1) - assert_equal(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7) + self.assertRaises(TypeError, solution.find_max_profit, None) + self.assertRaises(ValueError, solution.find_max_profit, []) + self.assertEqual(solution.find_max_profit([8, 5, 3, 2, 1]), -1) + self.assertEqual(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7) print('Success: test_max_profit') @@ -18,4 +18,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/maximizing_xor/maximizing_xor_challenge.ipynb b/online_judges/maximizing_xor/maximizing_xor_challenge.ipynb index f70979e..c877ae7 100644 --- a/online_judges/maximizing_xor/maximizing_xor_challenge.ipynb +++ b/online_judges/maximizing_xor/maximizing_xor_challenge.ipynb @@ -67,9 +67,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -91,20 +89,18 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_maximizing_xor.py\n", - "from nose.tools import assert_equal\n", + "import unittest\n", "\n", "\n", - "class TestMaximizingXor(object):\n", + "class TestMaximizingXor(unittest.TestCase):\n", "\n", " def test_maximizing_xor(self):\n", " solution = Solution()\n", - " assert_equal(solution.max_xor(10, 15), 7)\n", + " self.assertEqual(solution.max_xor(10, 15), 7)\n", " print('Success: test_maximizing_xor')\n", "\n", "\n", @@ -143,9 +139,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 } diff --git a/online_judges/maximizing_xor/maximizing_xor_solution.ipynb b/online_judges/maximizing_xor/maximizing_xor_solution.ipynb index 052ca75..9f10daa 100644 --- a/online_judges/maximizing_xor/maximizing_xor_solution.ipynb +++ b/online_judges/maximizing_xor/maximizing_xor_solution.ipynb @@ -77,9 +77,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -105,9 +103,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -119,14 +115,14 @@ ], "source": [ "%%writefile test_maximizing_xor.py\n", - "from nose.tools import assert_equal\n", + "import unittest\n", "\n", "\n", - "class TestMaximizingXor(object):\n", + "class TestMaximizingXor(unittest.TestCase):\n", "\n", " def test_maximizing_xor(self):\n", " solution = Solution()\n", - " assert_equal(solution.max_xor(10, 15), 7)\n", + " self.assertEqual(solution.max_xor(10, 15), 7)\n", " print('Success: test_maximizing_xor')\n", "\n", "\n", @@ -142,9 +138,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -175,9 +169,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 } diff --git a/online_judges/maximizing_xor/test_maximizing_xor.py b/online_judges/maximizing_xor/test_maximizing_xor.py index 5fa746b..0c53619 100644 --- a/online_judges/maximizing_xor/test_maximizing_xor.py +++ b/online_judges/maximizing_xor/test_maximizing_xor.py @@ -1,11 +1,11 @@ -from nose.tools import assert_equal +import unittest -class TestMaximizingXor(object): +class TestMaximizingXor(unittest.TestCase): def test_maximizing_xor(self): solution = Solution() - assert_equal(solution.max_xor(10, 15), 7) + self.assertEqual(solution.max_xor(10, 15), 7) print('Success: test_maximizing_xor') @@ -15,4 +15,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/merge_ranges/merge_ranges_challenge.ipynb b/online_judges/merge_ranges/merge_ranges_challenge.ipynb index 8f955e4..a8d3fb4 100644 --- a/online_judges/merge_ranges/merge_ranges_challenge.ipynb +++ b/online_judges/merge_ranges/merge_ranges_challenge.ipynb @@ -89,9 +89,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -118,30 +116,28 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_merge_ranges.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMergeRanges(object):\n", + "class TestMergeRanges(unittest.TestCase):\n", "\n", " def test_merge_ranges(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.merge_ranges, None)\n", - " assert_equal(solution.merge_ranges([]), [])\n", + " self.assertRaises(TypeError, solution.merge_ranges, None)\n", + " self.assertEqual(solution.merge_ranges([]), [])\n", " array = [(2, 3), (7, 9)]\n", " expected = [(2, 3), (7, 9)]\n", - " assert_equal(solution.merge_ranges(array), expected)\n", + " self.assertEqual(solution.merge_ranges(array), expected)\n", " array = [(2, 3), (3, 5), (7, 9), (8, 10)]\n", " expected = [(2, 5), (7, 10)]\n", - " assert_equal(solution.merge_ranges(array), expected)\n", + " self.assertEqual(solution.merge_ranges(array), expected)\n", " array = [(2, 3), (3, 5), (7, 9), (8, 10), (1, 11)]\n", " expected = [(1, 11)]\n", - " assert_equal(solution.merge_ranges(array), expected)\n", + " self.assertEqual(solution.merge_ranges(array), expected)\n", " print('Success: test_merge_ranges')\n", "\n", "\n", @@ -180,9 +176,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 } diff --git a/online_judges/merge_ranges/merge_ranges_solution.ipynb b/online_judges/merge_ranges/merge_ranges_solution.ipynb index 584315a..c0a443d 100644 --- a/online_judges/merge_ranges/merge_ranges_solution.ipynb +++ b/online_judges/merge_ranges/merge_ranges_solution.ipynb @@ -130,9 +130,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -168,9 +166,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -182,24 +178,24 @@ ], "source": [ "%%writefile test_merge_ranges.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMergeRanges(object):\n", + "class TestMergeRanges(unittest.TestCase):\n", "\n", " def test_merge_ranges(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.merge_ranges, None)\n", - " assert_equal(solution.merge_ranges([]), [])\n", + " self.assertRaises(TypeError, solution.merge_ranges, None)\n", + " self.assertEqual(solution.merge_ranges([]), [])\n", " array = [(2, 3), (7, 9)]\n", " expected = [(2, 3), (7, 9)]\n", - " assert_equal(solution.merge_ranges(array), expected)\n", + " self.assertEqual(solution.merge_ranges(array), expected)\n", " array = [(3, 5), (2, 3), (7, 9), (8, 10)]\n", " expected = [(2, 5), (7, 10)]\n", - " assert_equal(solution.merge_ranges(array), expected)\n", + " self.assertEqual(solution.merge_ranges(array), expected)\n", " array = [(2, 3), (3, 5), (7, 9), (8, 10), (1, 11)]\n", " expected = [(1, 11)]\n", - " assert_equal(solution.merge_ranges(array), expected)\n", + " self.assertEqual(solution.merge_ranges(array), expected)\n", " print('Success: test_merge_ranges')\n", "\n", "\n", @@ -215,9 +211,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -248,9 +242,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 } diff --git a/online_judges/merge_ranges/test_merge_ranges.py b/online_judges/merge_ranges/test_merge_ranges.py index 5d39cf2..95e0913 100644 --- a/online_judges/merge_ranges/test_merge_ranges.py +++ b/online_judges/merge_ranges/test_merge_ranges.py @@ -1,21 +1,21 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestMergeRanges(object): +class TestMergeRanges(unittest.TestCase): def test_merge_ranges(self): solution = Solution() - assert_raises(TypeError, solution.merge_ranges, None) - assert_equal(solution.merge_ranges([]), []) + self.assertRaises(TypeError, solution.merge_ranges, None) + self.assertEqual(solution.merge_ranges([]), []) array = [(2, 3), (7, 9)] expected = [(2, 3), (7, 9)] - assert_equal(solution.merge_ranges(array), expected) + self.assertEqual(solution.merge_ranges(array), expected) array = [(3, 5), (2, 3), (7, 9), (8, 10)] expected = [(2, 5), (7, 10)] - assert_equal(solution.merge_ranges(array), expected) + self.assertEqual(solution.merge_ranges(array), expected) array = [(2, 3), (3, 5), (7, 9), (8, 10), (1, 11)] expected = [(1, 11)] - assert_equal(solution.merge_ranges(array), expected) + self.assertEqual(solution.merge_ranges(array), expected) print('Success: test_merge_ranges') @@ -25,4 +25,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/move_zeroes/move_zeroes_challenge.ipynb b/online_judges/move_zeroes/move_zeroes_challenge.ipynb index d9b223c..3185a28 100644 --- a/online_judges/move_zeroes/move_zeroes_challenge.ipynb +++ b/online_judges/move_zeroes/move_zeroes_challenge.ipynb @@ -82,9 +82,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -111,38 +109,36 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_move_zeroes.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMoveZeroes(object):\n", + "class TestMoveZeroes(unittest.TestCase):\n", "\n", " def test_move_zeroes(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.move_zeroes, None)\n", + " self.assertRaises(TypeError, solution.move_zeroes, None)\n", " array = [0, 1, 0, 3, 12]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 3, 12, 0, 0])\n", + " self.assertEqual(array, [1, 3, 12, 0, 0])\n", " array = [1, 0]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 0])\n", + " self.assertEqual(array, [1, 0])\n", " array = [0, 1]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 0])\n", + " self.assertEqual(array, [1, 0])\n", " array = [0]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [0])\n", + " self.assertEqual(array, [0])\n", " array = [1]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1])\n", + " self.assertEqual(array, [1])\n", " array = [1, 1]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 1])\n", + " self.assertEqual(array, [1, 1])\n", " print('Success: test_move_zeroes')\n", "\n", "\n", @@ -181,9 +177,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 } diff --git a/online_judges/move_zeroes/move_zeroes_solution.ipynb b/online_judges/move_zeroes/move_zeroes_solution.ipynb index 7fabe45..1a7c598 100644 --- a/online_judges/move_zeroes/move_zeroes_solution.ipynb +++ b/online_judges/move_zeroes/move_zeroes_solution.ipynb @@ -125,9 +125,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -154,9 +152,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -168,32 +164,32 @@ ], "source": [ "%%writefile test_move_zeroes.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMoveZeroes(object):\n", + "class TestMoveZeroes(unittest.TestCase):\n", "\n", " def test_move_zeroes(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.move_zeroes, None)\n", + " self.assertRaises(TypeError, solution.move_zeroes, None)\n", " array = [0, 1, 0, 3, 12]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 3, 12, 0, 0])\n", + " self.assertEqual(array, [1, 3, 12, 0, 0])\n", " array = [1, 0]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 0])\n", + " self.assertEqual(array, [1, 0])\n", " array = [0, 1]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 0])\n", + " self.assertEqual(array, [1, 0])\n", " array = [0]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [0])\n", + " self.assertEqual(array, [0])\n", " array = [1]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1])\n", + " self.assertEqual(array, [1])\n", " array = [1, 1]\n", " solution.move_zeroes(array)\n", - " assert_equal(array, [1, 1])\n", + " self.assertEqual(array, [1, 1])\n", " print('Success: test_move_zeroes')\n", "\n", "\n", @@ -209,9 +205,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -242,9 +236,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 } diff --git a/online_judges/move_zeroes/test_move_zeroes.py b/online_judges/move_zeroes/test_move_zeroes.py index f968699..980a269 100644 --- a/online_judges/move_zeroes/test_move_zeroes.py +++ b/online_judges/move_zeroes/test_move_zeroes.py @@ -1,29 +1,29 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestMoveZeroes(object): +class TestMoveZeroes(unittest.TestCase): def test_move_zeroes(self): solution = Solution() - assert_raises(TypeError, solution.move_zeroes, None) + self.assertRaises(TypeError, solution.move_zeroes, None) array = [0, 1, 0, 3, 12] solution.move_zeroes(array) - assert_equal(array, [1, 3, 12, 0, 0]) + self.assertEqual(array, [1, 3, 12, 0, 0]) array = [1, 0] solution.move_zeroes(array) - assert_equal(array, [1, 0]) + self.assertEqual(array, [1, 0]) array = [0, 1] solution.move_zeroes(array) - assert_equal(array, [1, 0]) + self.assertEqual(array, [1, 0]) array = [0] solution.move_zeroes(array) - assert_equal(array, [0]) + self.assertEqual(array, [0]) array = [1] solution.move_zeroes(array) - assert_equal(array, [1]) + self.assertEqual(array, [1]) array = [1, 1] solution.move_zeroes(array) - assert_equal(array, [1, 1]) + self.assertEqual(array, [1, 1]) print('Success: test_move_zeroes') @@ -33,4 +33,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/mult_other_numbers/mult_other_numbers_challenge.ipynb b/online_judges/mult_other_numbers/mult_other_numbers_challenge.ipynb index 020b44c..80e1b45 100644 --- a/online_judges/mult_other_numbers/mult_other_numbers_challenge.ipynb +++ b/online_judges/mult_other_numbers/mult_other_numbers_challenge.ipynb @@ -79,9 +79,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -108,24 +106,22 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_mult_other_numbers.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMultOtherNumbers(object):\n", + "class TestMultOtherNumbers(unittest.TestCase):\n", "\n", " def test_mult_other_numbers(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.mult_other_numbers, None)\n", - " assert_equal(solution.mult_other_numbers([0]), [])\n", - " assert_equal(solution.mult_other_numbers([0, 1]), [1, 0])\n", - " assert_equal(solution.mult_other_numbers([0, 1, 2]), [2, 0, 0])\n", - " assert_equal(solution.mult_other_numbers([1, 2, 3, 4]), [24, 12, 8, 6])\n", + " self.assertRaises(TypeError, solution.mult_other_numbers, None)\n", + " self.assertEqual(solution.mult_other_numbers([0]), [])\n", + " self.assertEqual(solution.mult_other_numbers([0, 1]), [1, 0])\n", + " self.assertEqual(solution.mult_other_numbers([0, 1, 2]), [2, 0, 0])\n", + " self.assertEqual(solution.mult_other_numbers([1, 2, 3, 4]), [24, 12, 8, 6])\n", " print('Success: test_mult_other_numbers')\n", "\n", "\n", @@ -164,9 +160,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 } diff --git a/online_judges/mult_other_numbers/mult_other_numbers_solution.ipynb b/online_judges/mult_other_numbers/mult_other_numbers_solution.ipynb index 74d857c..fc4c5a9 100644 --- a/online_judges/mult_other_numbers/mult_other_numbers_solution.ipynb +++ b/online_judges/mult_other_numbers/mult_other_numbers_solution.ipynb @@ -130,9 +130,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -183,9 +181,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -197,18 +193,18 @@ ], "source": [ "%%writefile test_mult_other_numbers.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestMultOtherNumbers(object):\n", + "class TestMultOtherNumbers(unittest.TestCase):\n", "\n", " def test_mult_other_numbers(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.mult_other_numbers, None)\n", - " assert_equal(solution.mult_other_numbers([0]), [])\n", - " assert_equal(solution.mult_other_numbers([0, 1]), [1, 0])\n", - " assert_equal(solution.mult_other_numbers([0, 1, 2]), [2, 0, 0])\n", - " assert_equal(solution.mult_other_numbers([1, 2, 3, 4]), [24, 12, 8, 6])\n", + " self.assertRaises(TypeError, solution.mult_other_numbers, None)\n", + " self.assertEqual(solution.mult_other_numbers([0]), [])\n", + " self.assertEqual(solution.mult_other_numbers([0, 1]), [1, 0])\n", + " self.assertEqual(solution.mult_other_numbers([0, 1, 2]), [2, 0, 0])\n", + " self.assertEqual(solution.mult_other_numbers([1, 2, 3, 4]), [24, 12, 8, 6])\n", " print('Success: test_mult_other_numbers')\n", "\n", "\n", @@ -224,9 +220,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -257,9 +251,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 } diff --git a/online_judges/mult_other_numbers/test_mult_other_numbers.py b/online_judges/mult_other_numbers/test_mult_other_numbers.py index c1c5cca..10487f7 100644 --- a/online_judges/mult_other_numbers/test_mult_other_numbers.py +++ b/online_judges/mult_other_numbers/test_mult_other_numbers.py @@ -1,15 +1,15 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestMultOtherNumbers(object): +class TestMultOtherNumbers(unittest.TestCase): def test_mult_other_numbers(self): solution = Solution() - assert_raises(TypeError, solution.mult_other_numbers, None) - assert_equal(solution.mult_other_numbers([0]), []) - assert_equal(solution.mult_other_numbers([0, 1]), [1, 0]) - assert_equal(solution.mult_other_numbers([0, 1, 2]), [2, 0, 0]) - assert_equal(solution.mult_other_numbers([1, 2, 3, 4]), [24, 12, 8, 6]) + self.assertRaises(TypeError, solution.mult_other_numbers, None) + self.assertEqual(solution.mult_other_numbers([0]), []) + self.assertEqual(solution.mult_other_numbers([0, 1]), [1, 0]) + self.assertEqual(solution.mult_other_numbers([0, 1, 2]), [2, 0, 0]) + self.assertEqual(solution.mult_other_numbers([1, 2, 3, 4]), [24, 12, 8, 6]) print('Success: test_mult_other_numbers') @@ -19,4 +19,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/nim/nim_challenge.ipynb b/online_judges/nim/nim_challenge.ipynb index 068e7bc..9fa4bf7 100644 --- a/online_judges/nim/nim_challenge.ipynb +++ b/online_judges/nim/nim_challenge.ipynb @@ -84,9 +84,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -113,26 +111,24 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_can_win_nim.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_can_win_nim(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.can_win_nim, None)\n", - " assert_equal(solution.can_win_nim(1), True)\n", - " assert_equal(solution.can_win_nim(2), True)\n", - " assert_equal(solution.can_win_nim(3), True)\n", - " assert_equal(solution.can_win_nim(4), False)\n", - " assert_equal(solution.can_win_nim(7), True)\n", - " assert_equal(solution.can_win_nim(40), False)\n", + " self.assertRaises(TypeError, solution.can_win_nim, None)\n", + " self.assertEqual(solution.can_win_nim(1), True)\n", + " self.assertEqual(solution.can_win_nim(2), True)\n", + " self.assertEqual(solution.can_win_nim(3), True)\n", + " self.assertEqual(solution.can_win_nim(4), False)\n", + " self.assertEqual(solution.can_win_nim(7), True)\n", + " self.assertEqual(solution.can_win_nim(40), False)\n", " print('Success: test_can_win_nim')\n", "\n", "\n", @@ -171,9 +167,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 } diff --git a/online_judges/nim/nim_solution.ipynb b/online_judges/nim/nim_solution.ipynb index 0db4ec5..22b524d 100644 --- a/online_judges/nim/nim_solution.ipynb +++ b/online_judges/nim/nim_solution.ipynb @@ -87,9 +87,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -108,9 +106,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -122,20 +118,20 @@ ], "source": [ "%%writefile test_can_win_nim.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_can_win_nim(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.can_win_nim, None)\n", - " assert_equal(solution.can_win_nim(1), True)\n", - " assert_equal(solution.can_win_nim(2), True)\n", - " assert_equal(solution.can_win_nim(3), True)\n", - " assert_equal(solution.can_win_nim(4), False)\n", - " assert_equal(solution.can_win_nim(7), True)\n", - " assert_equal(solution.can_win_nim(40), False)\n", + " self.assertRaises(TypeError, solution.can_win_nim, None)\n", + " self.assertEqual(solution.can_win_nim(1), True)\n", + " self.assertEqual(solution.can_win_nim(2), True)\n", + " self.assertEqual(solution.can_win_nim(3), True)\n", + " self.assertEqual(solution.can_win_nim(4), False)\n", + " self.assertEqual(solution.can_win_nim(7), True)\n", + " self.assertEqual(solution.can_win_nim(40), False)\n", " print('Success: test_can_win_nim')\n", "\n", "\n", @@ -151,9 +147,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -184,9 +178,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 } diff --git a/online_judges/nim/test_can_win_nim.py b/online_judges/nim/test_can_win_nim.py index 92de456..eaf4ab4 100644 --- a/online_judges/nim/test_can_win_nim.py +++ b/online_judges/nim/test_can_win_nim.py @@ -1,17 +1,17 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSolution(object): +class TestSolution(unittest.TestCase): def test_can_win_nim(self): solution = Solution() - assert_raises(TypeError, solution.can_win_nim, None) - assert_equal(solution.can_win_nim(1), True) - assert_equal(solution.can_win_nim(2), True) - assert_equal(solution.can_win_nim(3), True) - assert_equal(solution.can_win_nim(4), False) - assert_equal(solution.can_win_nim(7), True) - assert_equal(solution.can_win_nim(40), False) + self.assertRaises(TypeError, solution.can_win_nim, None) + self.assertEqual(solution.can_win_nim(1), True) + self.assertEqual(solution.can_win_nim(2), True) + self.assertEqual(solution.can_win_nim(3), True) + self.assertEqual(solution.can_win_nim(4), False) + self.assertEqual(solution.can_win_nim(7), True) + self.assertEqual(solution.can_win_nim(40), False) print('Success: test_can_win_nim') @@ -21,4 +21,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/prod_three/prod_three_challenge.ipynb b/online_judges/prod_three/prod_three_challenge.ipynb index e9f12d5..a047109 100644 --- a/online_judges/prod_three/prod_three_challenge.ipynb +++ b/online_judges/prod_three/prod_three_challenge.ipynb @@ -79,9 +79,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -108,23 +106,21 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_prod_three.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestProdThree(object):\n", + "class TestProdThree(unittest.TestCase):\n", "\n", " def test_prod_three(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.max_prod_three, None)\n", - " assert_raises(ValueError, solution.max_prod_three, [1, 2])\n", - " assert_equal(solution.max_prod_three([5, -2, 3]), -30)\n", - " assert_equal(solution.max_prod_three([5, -2, 3, 1, -1, 4]), 60)\n", + " self.assertRaises(TypeError, solution.max_prod_three, None)\n", + " self.assertRaises(ValueError, solution.max_prod_three, [1, 2])\n", + " self.assertEqual(solution.max_prod_three([5, -2, 3]), -30)\n", + " self.assertEqual(solution.max_prod_three([5, -2, 3, 1, -1, 4]), 60)\n", " print('Success: test_prod_three')\n", "\n", "\n", @@ -163,9 +159,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 } diff --git a/online_judges/prod_three/prod_three_solution.ipynb b/online_judges/prod_three/prod_three_solution.ipynb index 015185c..457ce30 100644 --- a/online_judges/prod_three/prod_three_solution.ipynb +++ b/online_judges/prod_three/prod_three_solution.ipynb @@ -145,9 +145,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -198,9 +196,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -212,17 +208,17 @@ ], "source": [ "%%writefile test_prod_three.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestProdThree(object):\n", + "class TestProdThree(unittest.TestCase):\n", "\n", " def test_prod_three(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.max_prod_three, None)\n", - " assert_raises(ValueError, solution.max_prod_three, [1, 2])\n", - " assert_equal(solution.max_prod_three([5, -2, 3]), -30)\n", - " assert_equal(solution.max_prod_three([5, -2, 3, 1, -1, 4]), 60)\n", + " self.assertRaises(TypeError, solution.max_prod_three, None)\n", + " self.assertRaises(ValueError, solution.max_prod_three, [1, 2])\n", + " self.assertEqual(solution.max_prod_three([5, -2, 3]), -30)\n", + " self.assertEqual(solution.max_prod_three([5, -2, 3, 1, -1, 4]), 60)\n", " print('Success: test_prod_three')\n", "\n", "\n", @@ -238,9 +234,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -271,9 +265,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 } diff --git a/online_judges/prod_three/test_prod_three.py b/online_judges/prod_three/test_prod_three.py index bbe5ccd..09e1f5c 100644 --- a/online_judges/prod_three/test_prod_three.py +++ b/online_judges/prod_three/test_prod_three.py @@ -1,14 +1,14 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestProdThree(object): +class TestProdThree(unittest.TestCase): def test_prod_three(self): solution = Solution() - assert_raises(TypeError, solution.max_prod_three, None) - assert_raises(ValueError, solution.max_prod_three, [1, 2]) - assert_equal(solution.max_prod_three([5, -2, 3]), -30) - assert_equal(solution.max_prod_three([5, -2, 3, 1, -1, 4]), 60) + self.assertRaises(TypeError, solution.max_prod_three, None) + self.assertRaises(ValueError, solution.max_prod_three, [1, 2]) + self.assertEqual(solution.max_prod_three([5, -2, 3]), -30) + self.assertEqual(solution.max_prod_three([5, -2, 3, 1, -1, 4]), 60) print('Success: test_prod_three') @@ -18,4 +18,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/ransom_note/ransom_note_challenge.ipynb b/online_judges/ransom_note/ransom_note_challenge.ipynb index fbffabe..f967d75 100644 --- a/online_judges/ransom_note/ransom_note_challenge.ipynb +++ b/online_judges/ransom_note/ransom_note_challenge.ipynb @@ -78,9 +78,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -107,24 +105,22 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_ransom_note.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestRansomNote(object):\n", + "class TestRansomNote(unittest.TestCase):\n", "\n", " def test_ransom_note(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.match_note_to_magazine, None, None)\n", - " assert_equal(solution.match_note_to_magazine('', ''), True)\n", - " assert_equal(solution.match_note_to_magazine('a', 'b'), False)\n", - " assert_equal(solution.match_note_to_magazine('aa', 'ab'), False)\n", - " assert_equal(solution.match_note_to_magazine('aa', 'aab'), True)\n", + " self.assertRaises(TypeError, solution.match_note_to_magazine, None, None)\n", + " self.assertEqual(solution.match_note_to_magazine('', ''), True)\n", + " self.assertEqual(solution.match_note_to_magazine('a', 'b'), False)\n", + " self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False)\n", + " self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True)\n", " print('Success: test_ransom_note')\n", "\n", "\n", @@ -163,9 +159,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 } diff --git a/online_judges/ransom_note/ransom_note_solution.ipynb b/online_judges/ransom_note/ransom_note_solution.ipynb index 345e0a0..9210d60 100644 --- a/online_judges/ransom_note/ransom_note_solution.ipynb +++ b/online_judges/ransom_note/ransom_note_solution.ipynb @@ -83,9 +83,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -119,9 +117,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -133,18 +129,18 @@ ], "source": [ "%%writefile test_ransom_note.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestRansomNote(object):\n", + "class TestRansomNote(unittest.TestCase):\n", "\n", " def test_ransom_note(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.match_note_to_magazine, None, None)\n", - " assert_equal(solution.match_note_to_magazine('', ''), True)\n", - " assert_equal(solution.match_note_to_magazine('a', 'b'), False)\n", - " assert_equal(solution.match_note_to_magazine('aa', 'ab'), False)\n", - " assert_equal(solution.match_note_to_magazine('aa', 'aab'), True)\n", + " self.assertRaises(TypeError, solution.match_note_to_magazine, None, None)\n", + " self.assertEqual(solution.match_note_to_magazine('', ''), True)\n", + " self.assertEqual(solution.match_note_to_magazine('a', 'b'), False)\n", + " self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False)\n", + " self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True)\n", " print('Success: test_ransom_note')\n", "\n", "\n", @@ -160,9 +156,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -193,9 +187,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 } diff --git a/online_judges/ransom_note/test_ransom_note.py b/online_judges/ransom_note/test_ransom_note.py index 1966b9e..dc8b41d 100644 --- a/online_judges/ransom_note/test_ransom_note.py +++ b/online_judges/ransom_note/test_ransom_note.py @@ -1,15 +1,15 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestRansomNote(object): +class TestRansomNote(unittest.TestCase): def test_ransom_note(self): solution = Solution() - assert_raises(TypeError, solution.match_note_to_magazine, None, None) - assert_equal(solution.match_note_to_magazine('', ''), True) - assert_equal(solution.match_note_to_magazine('a', 'b'), False) - assert_equal(solution.match_note_to_magazine('aa', 'ab'), False) - assert_equal(solution.match_note_to_magazine('aa', 'aab'), True) + self.assertRaises(TypeError, solution.match_note_to_magazine, None, None) + self.assertEqual(solution.match_note_to_magazine('', ''), True) + self.assertEqual(solution.match_note_to_magazine('a', 'b'), False) + self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False) + self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True) print('Success: test_ransom_note') @@ -19,4 +19,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/sentence_screen_fit/sentence_screen_fit_challenge.ipynb b/online_judges/sentence_screen_fit/sentence_screen_fit_challenge.ipynb index eb42f7d..653cda2 100644 --- a/online_judges/sentence_screen_fit/sentence_screen_fit_challenge.ipynb +++ b/online_judges/sentence_screen_fit/sentence_screen_fit_challenge.ipynb @@ -135,9 +135,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -164,34 +162,32 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_count_sentence_fit.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_count_sentence_fit(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.count_sentence_fit, \n", + " self.assertRaises(TypeError, solution.count_sentence_fit, \n", " None, None, None)\n", - " assert_raises(ValueError, solution.count_sentence_fit, \n", + " self.assertRaises(ValueError, solution.count_sentence_fit, \n", " 'abc', rows=-1, cols=-1)\n", " sentence = [\"hello\", \"world\"]\n", " expected = 1\n", - " assert_equal(solution.count_sentence_fit(sentence, rows=2, cols=8),\n", + " self.assertEqual(solution.count_sentence_fit(sentence, rows=2, cols=8),\n", " expected)\n", " sentence = [\"a\", \"bcd\", \"e\"]\n", " expected = 2\n", - " assert_equal(solution.count_sentence_fit(sentence, rows=3, cols=6),\n", + " self.assertEqual(solution.count_sentence_fit(sentence, rows=3, cols=6),\n", " expected)\n", " sentence = [\"I\", \"had\", \"apple\", \"pie\"]\n", " expected = 1\n", - " assert_equal(solution.count_sentence_fit(sentence, rows=4, cols=5),\n", + " self.assertEqual(solution.count_sentence_fit(sentence, rows=4, cols=5),\n", " expected)\n", " print('Success: test_count_sentence_fit')\n", "\n", @@ -231,9 +227,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 } diff --git a/online_judges/sentence_screen_fit/sentence_screen_fit_solution.ipynb b/online_judges/sentence_screen_fit/sentence_screen_fit_solution.ipynb index 49829e7..6ed2855 100644 --- a/online_judges/sentence_screen_fit/sentence_screen_fit_solution.ipynb +++ b/online_judges/sentence_screen_fit/sentence_screen_fit_solution.ipynb @@ -153,9 +153,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -228,9 +226,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -242,28 +238,28 @@ ], "source": [ "%%writefile test_count_sentence_fit.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSolution(object):\n", + "class TestSolution(unittest.TestCase):\n", "\n", " def test_count_sentence_fit(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.count_sentence_fit, \n", + " self.assertRaises(TypeError, solution.count_sentence_fit, \n", " None, None, None)\n", - " assert_raises(ValueError, solution.count_sentence_fit, \n", + " self.assertRaises(ValueError, solution.count_sentence_fit, \n", " 'abc', rows=-1, cols=-1)\n", " sentence = [\"hello\", \"world\"]\n", " expected = 1\n", - " assert_equal(solution.count_sentence_fit(sentence, rows=2, cols=8),\n", + " self.assertEqual(solution.count_sentence_fit(sentence, rows=2, cols=8),\n", " expected)\n", " sentence = [\"a\", \"bcd\", \"e\"]\n", " expected = 2\n", - " assert_equal(solution.count_sentence_fit(sentence, rows=3, cols=6),\n", + " self.assertEqual(solution.count_sentence_fit(sentence, rows=3, cols=6),\n", " expected)\n", " sentence = [\"I\", \"had\", \"apple\", \"pie\"]\n", " expected = 1\n", - " assert_equal(solution.count_sentence_fit(sentence, rows=4, cols=5),\n", + " self.assertEqual(solution.count_sentence_fit(sentence, rows=4, cols=5),\n", " expected)\n", " print('Success: test_count_sentence_fit')\n", "\n", @@ -280,9 +276,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -313,9 +307,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 } diff --git a/online_judges/sentence_screen_fit/test_count_sentence_fit.py b/online_judges/sentence_screen_fit/test_count_sentence_fit.py index 96db218..a66247f 100644 --- a/online_judges/sentence_screen_fit/test_count_sentence_fit.py +++ b/online_judges/sentence_screen_fit/test_count_sentence_fit.py @@ -1,25 +1,25 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSolution(object): +class TestSolution(unittest.TestCase): def test_count_sentence_fit(self): solution = Solution() - assert_raises(TypeError, solution.count_sentence_fit, + self.assertRaises(TypeError, solution.count_sentence_fit, None, None, None) - assert_raises(ValueError, solution.count_sentence_fit, + self.assertRaises(ValueError, solution.count_sentence_fit, 'abc', rows=-1, cols=-1) sentence = ["hello", "world"] expected = 1 - assert_equal(solution.count_sentence_fit(sentence, rows=2, cols=8), + self.assertEqual(solution.count_sentence_fit(sentence, rows=2, cols=8), expected) sentence = ["a", "bcd", "e"] expected = 2 - assert_equal(solution.count_sentence_fit(sentence, rows=3, cols=6), + self.assertEqual(solution.count_sentence_fit(sentence, rows=3, cols=6), expected) sentence = ["I", "had", "apple", "pie"] expected = 1 - assert_equal(solution.count_sentence_fit(sentence, rows=4, cols=5), + self.assertEqual(solution.count_sentence_fit(sentence, rows=4, cols=5), expected) print('Success: test_count_sentence_fit') @@ -30,4 +30,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/str_diff/str_diff_challenge.ipynb b/online_judges/str_diff/str_diff_challenge.ipynb index 85b3055..5e6f681 100644 --- a/online_judges/str_diff/str_diff_challenge.ipynb +++ b/online_judges/str_diff/str_diff_challenge.ipynb @@ -75,9 +75,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -104,21 +102,19 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_str_diff.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestFindDiff(object):\n", + "class TestFindDiff(unittest.TestCase):\n", "\n", " def test_find_diff(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_diff, None)\n", - " assert_equal(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')\n", + " self.assertRaises(TypeError, solution.find_diff, None)\n", + " self.assertEqual(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')\n", " print('Success: test_find_diff')\n", "\n", "\n", @@ -157,9 +153,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 } diff --git a/online_judges/str_diff/str_diff_solution.ipynb b/online_judges/str_diff/str_diff_solution.ipynb index 1d738da..9f93a75 100644 --- a/online_judges/str_diff/str_diff_solution.ipynb +++ b/online_judges/str_diff/str_diff_solution.ipynb @@ -80,9 +80,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -116,9 +114,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -130,15 +126,15 @@ ], "source": [ "%%writefile test_str_diff.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestFindDiff(object):\n", + "class TestFindDiff(unittest.TestCase):\n", "\n", " def test_find_diff(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.find_diff, None)\n", - " assert_equal(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')\n", + " self.assertRaises(TypeError, solution.find_diff, None)\n", + " self.assertEqual(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')\n", " print('Success: test_find_diff')\n", "\n", "\n", @@ -154,9 +150,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -187,9 +181,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 } diff --git a/online_judges/str_diff/test_str_diff.py b/online_judges/str_diff/test_str_diff.py index eba7f7d..9fed045 100644 --- a/online_judges/str_diff/test_str_diff.py +++ b/online_judges/str_diff/test_str_diff.py @@ -1,12 +1,12 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestFindDiff(object): +class TestFindDiff(unittest.TestCase): def test_find_diff(self): solution = Solution() - assert_raises(TypeError, solution.find_diff, None) - assert_equal(solution.find_diff('aaabbcdd', 'abdbacade'), 'e') + self.assertRaises(TypeError, solution.find_diff, None) + self.assertEqual(solution.find_diff('aaabbcdd', 'abdbacade'), 'e') print('Success: test_find_diff') @@ -16,4 +16,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/sub_two/sub_two_challenge.ipynb b/online_judges/sub_two/sub_two_challenge.ipynb index e69b3d9..2a87040 100644 --- a/online_judges/sub_two/sub_two_challenge.ipynb +++ b/online_judges/sub_two/sub_two_challenge.ipynb @@ -78,9 +78,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -107,24 +105,22 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_sub_two.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSubTwo(object):\n", + "class TestSubTwo(unittest.TestCase):\n", "\n", " def test_sub_two(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.sub_two, None)\n", - " assert_equal(solution.sub_two(7, 5), 2)\n", - " assert_equal(solution.sub_two(-5, -7), 2)\n", - " assert_equal(solution.sub_two(-5, 7), -12)\n", - " assert_equal(solution.sub_two(5, -7), 12)\n", + " self.assertRaises(TypeError, solution.sub_two, None)\n", + " self.assertEqual(solution.sub_two(7, 5), 2)\n", + " self.assertEqual(solution.sub_two(-5, -7), 2)\n", + " self.assertEqual(solution.sub_two(-5, 7), -12)\n", + " self.assertEqual(solution.sub_two(5, -7), 12)\n", " print('Success: test_sub_two')\n", "\n", "\n", @@ -163,9 +159,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 } diff --git a/online_judges/sub_two/sub_two_solution.ipynb b/online_judges/sub_two/sub_two_solution.ipynb index 761650f..6088a75 100644 --- a/online_judges/sub_two/sub_two_solution.ipynb +++ b/online_judges/sub_two/sub_two_solution.ipynb @@ -100,9 +100,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -127,9 +125,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -141,18 +137,18 @@ ], "source": [ "%%writefile test_sub_two.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSubTwo(object):\n", + "class TestSubTwo(unittest.TestCase):\n", "\n", " def test_sub_two(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.sub_two, None)\n", - " assert_equal(solution.sub_two(7, 5), 2)\n", - " assert_equal(solution.sub_two(-5, -7), 2)\n", - " assert_equal(solution.sub_two(-5, 7), -12)\n", - " assert_equal(solution.sub_two(5, -7), 12)\n", + " self.assertRaises(TypeError, solution.sub_two, None)\n", + " self.assertEqual(solution.sub_two(7, 5), 2)\n", + " self.assertEqual(solution.sub_two(-5, -7), 2)\n", + " self.assertEqual(solution.sub_two(-5, 7), -12)\n", + " self.assertEqual(solution.sub_two(5, -7), 12)\n", " print('Success: test_sub_two')\n", "\n", "\n", @@ -169,7 +165,6 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [ @@ -202,9 +197,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 } diff --git a/online_judges/sub_two/test_sub_two.py b/online_judges/sub_two/test_sub_two.py index f022a3f..aab56e8 100644 --- a/online_judges/sub_two/test_sub_two.py +++ b/online_judges/sub_two/test_sub_two.py @@ -1,15 +1,15 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSubTwo(object): +class TestSubTwo(unittest.TestCase): def test_sub_two(self): solution = Solution() - assert_raises(TypeError, solution.sub_two, None) - assert_equal(solution.sub_two(7, 5), 2) - assert_equal(solution.sub_two(-5, -7), 2) - assert_equal(solution.sub_two(-5, 7), -12) - assert_equal(solution.sub_two(5, -7), 12) + self.assertRaises(TypeError, solution.sub_two, None) + self.assertEqual(solution.sub_two(7, 5), 2) + self.assertEqual(solution.sub_two(-5, -7), 2) + self.assertEqual(solution.sub_two(-5, 7), -12) + self.assertEqual(solution.sub_two(5, -7), 12) print('Success: test_sub_two') @@ -19,4 +19,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/sum_two/sum_two_challenge.ipynb b/online_judges/sum_two/sum_two_challenge.ipynb index bf48578..c1d0767 100644 --- a/online_judges/sum_two/sum_two_challenge.ipynb +++ b/online_judges/sum_two/sum_two_challenge.ipynb @@ -72,9 +72,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -101,23 +99,21 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# %load test_sum_two.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSumTwo(object):\n", + "class TestSumTwo(unittest.TestCase):\n", "\n", " def test_sum_two(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.sum_two, None)\n", - " assert_equal(solution.sum_two(5, 7), 12)\n", - " assert_equal(solution.sum_two(-5, -7), -12)\n", - " assert_equal(solution.sum_two(5, -7), -2)\n", + " self.assertRaises(TypeError, solution.sum_two, None)\n", + " self.assertEqual(solution.sum_two(5, 7), 12)\n", + " self.assertEqual(solution.sum_two(-5, -7), -12)\n", + " self.assertEqual(solution.sum_two(5, -7), -2)\n", " print('Success: test_sum_two')\n", "\n", "\n", @@ -156,9 +152,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 } diff --git a/online_judges/sum_two/sum_two_solution.ipynb b/online_judges/sum_two/sum_two_solution.ipynb index c7807ec..a776e1c 100644 --- a/online_judges/sum_two/sum_two_solution.ipynb +++ b/online_judges/sum_two/sum_two_solution.ipynb @@ -116,9 +116,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Solution(object):\n", @@ -143,9 +141,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -157,17 +153,17 @@ ], "source": [ "%%writefile test_sum_two.py\n", - "from nose.tools import assert_equal, assert_raises\n", + "import unittest\n", "\n", "\n", - "class TestSumTwo(object):\n", + "class TestSumTwo(unittest.TestCase):\n", "\n", " def test_sum_two(self):\n", " solution = Solution()\n", - " assert_raises(TypeError, solution.sum_two, None)\n", - " assert_equal(solution.sum_two(5, 7), 12)\n", - " assert_equal(solution.sum_two(-5, -7), -12)\n", - " assert_equal(solution.sum_two(5, -7), -2)\n", + " self.assertRaises(TypeError, solution.sum_two, None)\n", + " self.assertEqual(solution.sum_two(5, 7), 12)\n", + " self.assertEqual(solution.sum_two(-5, -7), -12)\n", + " self.assertEqual(solution.sum_two(5, -7), -2)\n", " print('Success: test_sum_two')\n", "\n", "\n", @@ -184,7 +180,6 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [ @@ -217,9 +212,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 } diff --git a/online_judges/sum_two/test_sum_two.py b/online_judges/sum_two/test_sum_two.py index 82a5ada..10b5b93 100644 --- a/online_judges/sum_two/test_sum_two.py +++ b/online_judges/sum_two/test_sum_two.py @@ -1,14 +1,14 @@ -from nose.tools import assert_equal, assert_raises +import unittest -class TestSumTwo(object): +class TestSumTwo(unittest.TestCase): def test_sum_two(self): solution = Solution() - assert_raises(TypeError, solution.sum_two, None) - assert_equal(solution.sum_two(5, 7), 12) - assert_equal(solution.sum_two(-5, -7), -12) - assert_equal(solution.sum_two(5, -7), -2) + self.assertRaises(TypeError, solution.sum_two, None) + self.assertEqual(solution.sum_two(5, 7), 12) + self.assertEqual(solution.sum_two(-5, -7), -12) + self.assertEqual(solution.sum_two(5, -7), -2) print('Success: test_sum_two') @@ -18,4 +18,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/online_judges/utopian_tree/test_utopian_tree.py b/online_judges/utopian_tree/test_utopian_tree.py index 6d11808..a4339c1 100644 --- a/online_judges/utopian_tree/test_utopian_tree.py +++ b/online_judges/utopian_tree/test_utopian_tree.py @@ -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() \ No newline at end of file + main() diff --git a/online_judges/utopian_tree/utopian_tree_challenge.ipynb b/online_judges/utopian_tree/utopian_tree_challenge.ipynb index a91cbc2..b736238 100644 --- a/online_judges/utopian_tree/utopian_tree_challenge.ipynb +++ b/online_judges/utopian_tree/utopian_tree_challenge.ipynb @@ -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 } diff --git a/online_judges/utopian_tree/utopian_tree_solution.ipynb b/online_judges/utopian_tree/utopian_tree_solution.ipynb index d8ee1b3..76d4b78 100644 --- a/online_judges/utopian_tree/utopian_tree_solution.ipynb +++ b/online_judges/utopian_tree/utopian_tree_solution.ipynb @@ -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 }