#273: Remove nose dependency for templates/ (#284)

This commit is contained in:
Donne Martin 2020-07-16 21:37:21 -04:00 committed by GitHub
parent 0236a45a94
commit a072a7e573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 38 deletions

View File

@ -66,9 +66,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [], "outputs": [],
"source": [ "source": [
"def foo(val):\n", "def foo(val):\n",
@ -93,9 +91,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [], "outputs": [],
"source": [ "source": [
"%load test_foo.py" "%load test_foo.py"
@ -113,23 +109,23 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython3",
"version": "2.7.10" "version": "3.7.2"
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 0 "nbformat_minor": 1
} }

View File

@ -69,9 +69,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [], "outputs": [],
"source": [ "source": [
"def foo(val):\n", "def foo(val):\n",
@ -88,9 +86,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -102,15 +98,15 @@
], ],
"source": [ "source": [
"%%writefile test_foo.py\n", "%%writefile test_foo.py\n",
"from nose.tools import assert_equal\n", "import unittest\n",
"\n", "\n",
"\n", "\n",
"class TestFoo(object):\n", "class TestFoo(unittest.TestCase):\n",
"\n", "\n",
" def test_foo(self):\n", " def test_foo(self):\n",
" assert_equal(foo(None), None)\n", " self.assertEqual(foo(None), None)\n",
" assert_equal(foo(0), 0)\n", " self.assertEqual(foo(0), 0)\n",
" assert_equal(foo('bar'), 'bar')\n", " self.assertEqual(foo('bar'), 'bar')\n",
" print('Success: test_foo')\n", " print('Success: test_foo')\n",
"\n", "\n",
"\n", "\n",
@ -126,9 +122,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -145,23 +139,23 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython3",
"version": "2.7.10" "version": "3.7.2"
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 0 "nbformat_minor": 1
} }

View File

@ -1,17 +1,19 @@
from nose.tools import assert_equal import unittest
class TestFoo(object): class TestFoo(unittest.TestCase):
def test_foo(self): def test_foo(self):
assert_equal(foo(None), None) self.assertEqual(foo(None), None)
assert_equal(foo(0), 0) self.assertEqual(foo(0), 0)
assert_equal(foo('bar'), 'bar') self.assertEqual(foo('bar'), 'bar')
print('Success: test_foo') print('Success: test_foo')
def main(): def main():
test = TestFoo() test = TestFoo()
test.test_foo() test.test_foo()
if __name__ == '__main__': if __name__ == '__main__':
main() main()