35 lines
718 B
Plaintext
35 lines
718 B
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Unit-Test\n",
|
||
|
"\n",
|
||
|
"import unittest\n",
|
||
|
"\n",
|
||
|
"def is_palindrome(s : str):\n",
|
||
|
" return s == s[::-1]\n",
|
||
|
"\n",
|
||
|
"class KnownInput(unittest.TestCase):\n",
|
||
|
" knownValues = (('lego', False), ('radar', True))\n",
|
||
|
"\n",
|
||
|
" def testKnownValues(self):\n",
|
||
|
" for word, palin in self.knownValues:\n",
|
||
|
" result = is_palindrome(word)\n",
|
||
|
" self.assertEqual(result, palin)"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"language_info": {
|
||
|
"name": "python"
|
||
|
},
|
||
|
"orig_nbformat": 4
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|