Commit 4f55b497 authored by Franck Thollard's avatar Franck Thollard
Browse files

WIP : adding testing

parent 5396f64d
......@@ -86,55 +86,17 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"test_add (__main__.TestMyStuff0)\n",
"test max_temp computes correctly ... "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"result = 5\n",
"result = aabb\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ok\n",
"\n",
"----------------------------------------------------------------------\n",
"Ran 1 test in 0.004s\n",
"\n",
"OK\n"
]
}
],
"outputs": [],
"source": [
"import unittest\n",
"import unittest \n",
"\n",
"def add(arg0, arg1):\n",
" \"\"\"Print and return the sum of the two arguments (duck typing).\"\"\"\n",
" result = arg0 + arg1\n",
" print('result = ', result)\n",
" return result\n",
"\n",
"\n",
"class TestMyStuff(unittest.TestCase): \n",
" def test_add(self):\n",
" \"\"\" test max_temp computes correctly\"\"\"\n",
" self.assertEqual(8, add(3, 5))\n",
" self.assertEqual(\"aabb\", add(\"aa\", \"bb\"))\n",
"\n",
"_res = unittest.TextTestRunner(verbosity=2).run(unittest.TestLoader().loadTestsFromTestCase(TestMyStuff0))"
" return result\n"
]
},
{
......@@ -1224,7 +1186,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
}
},
"nbformat": 4,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment