#273: Remove nose dependency for arrays_strings/ (#274)

This commit is contained in:
Donne Martin
2020-07-04 10:56:49 -04:00
committed by GitHub
parent 9678c5ee69
commit b598f474af
34 changed files with 399 additions and 481 deletions

View File

@@ -76,9 +76,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"def compress_string(string):\n",
@@ -105,22 +103,24 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# %load test_compress.py\n",
"from nose.tools import assert_equal\n",
"import unittest\n",
"\n",
"\n",
"class TestCompress(object):\n",
"class TestCompress(unittest.TestCase):\n",
"\n",
" def test_compress(self, func):\n",
" assert_equal(func(None), None)\n",
" assert_equal(func(''), '')\n",
" assert_equal(func('AABBCC'), 'AABBCC')\n",
" assert_equal(func('AAABCCDDDD'), 'A3BCCD4')\n",
" self.assertEqual(func(None), None)\n",
" self.assertEqual(func(''), '')\n",
" self.assertEqual(func('AABBCC'), 'AABBCC')\n",
" self.assertEqual(func('AAABCCDDDD'), 'A3BCCD4')\n",
" self.assertEqual(\n",
" func('aaBCCEFFFFKKMMMMMMP taaammanlaarrrr seeeeeeeeek tooo'),\n",
" 'aaBCCEF4KKM6P ta3mmanlaar4 se9k to3',\n",
" )\n",
" print('Success: test_compress')\n",
"\n",
"\n",
@@ -159,9 +159,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
}

View File

@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook was prepared by [hashhar](https://github.com/hashhar), second solution added by [janhak] (https://github.com/janhak). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges)."
"This notebook was prepared by [hashhar](https://github.com/hashhar), second solution added by [janhak](https://github.com/janhak). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges)."
]
},
{
@@ -103,10 +103,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"def compress_string(string):\n",
@@ -200,10 +198,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def split_to_blocks(string):\n",
@@ -239,24 +235,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting test_compress.py\n"
]
}
],
"source": [
"%%writefile test_compress.py\n",
"from nose.tools import assert_equal\n",
"import unittest\n",
"\n",
"\n",
"class TestCompress(object):\n",
"class TestCompress(unittest.TestCase):\n",
"\n",
" def test_compress(self, func):\n",
" assert_equal(func(None), None)\n",
" assert_equal(func(''), '')\n",
" assert_equal(func('AABBCC'), 'AABBCC')\n",
" assert_equal(func('AAABCCDDDD'), 'A3BCCD4')\n",
" assert_equal(func('aaBCCEFFFFKKMMMMMMP taaammanlaarrrr seeeeeeeeek tooo'), 'aaBCCEF4KKM6P ta3mmanlaar4 se9k to3')\n",
" self.assertEqual(func(None), None)\n",
" self.assertEqual(func(''), '')\n",
" self.assertEqual(func('AABBCC'), 'AABBCC')\n",
" self.assertEqual(func('AAABCCDDDD'), 'A3BCCD4')\n",
" self.assertEqual(\n",
" func('aaBCCEFFFFKKMMMMMMP taaammanlaarrrr seeeeeeeeek tooo'),\n",
" 'aaBCCEF4KKM6P ta3mmanlaar4 se9k to3',\n",
" )\n",
" print('Success: test_compress')\n",
"\n",
"\n",
@@ -271,11 +276,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Success: test_compress\n"
]
}
],
"source": [
"%run -i test_compress.py"
]
@@ -297,9 +308,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
}

View File

@@ -1,14 +1,17 @@
from nose.tools import assert_equal
import unittest
class TestCompress(object):
class TestCompress(unittest.TestCase):
def test_compress(self, func):
assert_equal(func(None), None)
assert_equal(func(''), '')
assert_equal(func('AABBCC'), 'AABBCC')
assert_equal(func('AAABCCDDDD'), 'A3BCCD4')
assert_equal(func('aaBCCEFFFFKKMMMMMMP taaammanlaarrrr seeeeeeeeek tooo'), 'aaBCCEF4KKM6P ta3mmanlaar4 se9k to3')
self.assertEqual(func(None), None)
self.assertEqual(func(''), '')
self.assertEqual(func('AABBCC'), 'AABBCC')
self.assertEqual(func('AAABCCDDDD'), 'A3BCCD4')
self.assertEqual(
func('aaBCCEFFFFKKMMMMMMP taaammanlaarrrr seeeeeeeeek tooo'),
'aaBCCEF4KKM6P ta3mmanlaar4 se9k to3',
)
print('Success: test_compress')
@@ -18,4 +21,4 @@ def main():
if __name__ == '__main__':
main()
main()