Skip to content

Commit

Permalink
#273: Remove nose dependency for templates/
Browse files Browse the repository at this point in the history
  • Loading branch information
donnemartin committed Jul 17, 2020
1 parent 0236a45 commit 429d0e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 38 deletions.
20 changes: 8 additions & 12 deletions templates/foo_challenge.ipynb
Expand Up @@ -66,9 +66,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"def foo(val):\n",
Expand All @@ -93,9 +91,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"%load test_foo.py"
Expand All @@ -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
}
34 changes: 14 additions & 20 deletions templates/foo_solution.ipynb
Expand Up @@ -69,9 +69,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"def foo(val):\n",
Expand All @@ -88,9 +86,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand All @@ -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",
Expand All @@ -126,9 +122,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand All @@ -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
}
14 changes: 8 additions & 6 deletions 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()
main()

0 comments on commit 429d0e6

Please sign in to comment.