diff --git a/templates/foo_challenge.ipynb b/templates/foo_challenge.ipynb index 916ab2c..eea58d4 100644 --- a/templates/foo_challenge.ipynb +++ b/templates/foo_challenge.ipynb @@ -66,9 +66,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "def foo(val):\n", @@ -93,9 +91,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "%load test_foo.py" @@ -113,23 +109,23 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" + "pygments_lexer": "ipython3", + "version": "3.7.2" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/templates/foo_solution.ipynb b/templates/foo_solution.ipynb index e2ed00a..3980265 100644 --- a/templates/foo_solution.ipynb +++ b/templates/foo_solution.ipynb @@ -69,9 +69,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "def foo(val):\n", @@ -88,9 +86,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -102,15 +98,15 @@ ], "source": [ "%%writefile test_foo.py\n", - "from nose.tools import assert_equal\n", + "import unittest\n", "\n", "\n", - "class TestFoo(object):\n", + "class TestFoo(unittest.TestCase):\n", "\n", " def test_foo(self):\n", - " assert_equal(foo(None), None)\n", - " assert_equal(foo(0), 0)\n", - " assert_equal(foo('bar'), 'bar')\n", + " self.assertEqual(foo(None), None)\n", + " self.assertEqual(foo(0), 0)\n", + " self.assertEqual(foo('bar'), 'bar')\n", " print('Success: test_foo')\n", "\n", "\n", @@ -126,9 +122,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -145,23 +139,23 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" + "pygments_lexer": "ipython3", + "version": "3.7.2" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/templates/test_foo.py b/templates/test_foo.py index 76fec58..0428ebb 100644 --- a/templates/test_foo.py +++ b/templates/test_foo.py @@ -1,17 +1,19 @@ -from nose.tools import assert_equal +import unittest -class TestFoo(object): +class TestFoo(unittest.TestCase): def test_foo(self): - assert_equal(foo(None), None) - assert_equal(foo(0), 0) - assert_equal(foo('bar'), 'bar') + self.assertEqual(foo(None), None) + self.assertEqual(foo(0), 0) + self.assertEqual(foo('bar'), 'bar') print('Success: test_foo') + def main(): test = TestFoo() test.test_foo() + if __name__ == '__main__': - main() \ No newline at end of file + main()