mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-06 17:38:02 +00:00
@@ -82,9 +82,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Permutations(object):\n",
|
||||
@@ -111,28 +109,26 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_permutations.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestPermutations(object):\n",
|
||||
"class TestPermutations(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_permutations(self):\n",
|
||||
" permutations = Permutations()\n",
|
||||
" assert_equal(permutations.find_permutations(None), None)\n",
|
||||
" assert_equal(permutations.find_permutations(''), '')\n",
|
||||
" self.assertEqual(permutations.find_permutations(None), None)\n",
|
||||
" self.assertEqual(permutations.find_permutations(''), '')\n",
|
||||
" string = 'AABC'\n",
|
||||
" expected = [\n",
|
||||
" 'AABC', 'AACB', 'ABAC', 'ABCA',\n",
|
||||
" 'ACAB', 'ACBA', 'BAAC', 'BACA',\n",
|
||||
" 'BCAA', 'CAAB', 'CABA', 'CBAA'\n",
|
||||
" ]\n",
|
||||
" assert_equal(permutations.find_permutations(string), expected)\n",
|
||||
" self.assertEqual(permutations.find_permutations(string), expected)\n",
|
||||
" print('Success: test_permutations')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -171,9 +167,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user