#273: Remove nose dependency for online_judges/ (#282)

This commit is contained in:
Donne Martin
2020-07-14 21:34:08 -04:00
committed by GitHub
parent 67505c49b2
commit 46d3939632
60 changed files with 575 additions and 782 deletions

View File

@@ -78,9 +78,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"class Solution(object):\n",
@@ -107,24 +105,22 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# %load test_ransom_note.py\n",
"from nose.tools import assert_equal, assert_raises\n",
"import unittest\n",
"\n",
"\n",
"class TestRansomNote(object):\n",
"class TestRansomNote(unittest.TestCase):\n",
"\n",
" def test_ransom_note(self):\n",
" solution = Solution()\n",
" assert_raises(TypeError, solution.match_note_to_magazine, None, None)\n",
" assert_equal(solution.match_note_to_magazine('', ''), True)\n",
" assert_equal(solution.match_note_to_magazine('a', 'b'), False)\n",
" assert_equal(solution.match_note_to_magazine('aa', 'ab'), False)\n",
" assert_equal(solution.match_note_to_magazine('aa', 'aab'), True)\n",
" self.assertRaises(TypeError, solution.match_note_to_magazine, None, None)\n",
" self.assertEqual(solution.match_note_to_magazine('', ''), True)\n",
" self.assertEqual(solution.match_note_to_magazine('a', 'b'), False)\n",
" self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False)\n",
" self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True)\n",
" print('Success: test_ransom_note')\n",
"\n",
"\n",
@@ -163,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

@@ -83,9 +83,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"class Solution(object):\n",
@@ -119,9 +117,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -133,18 +129,18 @@
],
"source": [
"%%writefile test_ransom_note.py\n",
"from nose.tools import assert_equal, assert_raises\n",
"import unittest\n",
"\n",
"\n",
"class TestRansomNote(object):\n",
"class TestRansomNote(unittest.TestCase):\n",
"\n",
" def test_ransom_note(self):\n",
" solution = Solution()\n",
" assert_raises(TypeError, solution.match_note_to_magazine, None, None)\n",
" assert_equal(solution.match_note_to_magazine('', ''), True)\n",
" assert_equal(solution.match_note_to_magazine('a', 'b'), False)\n",
" assert_equal(solution.match_note_to_magazine('aa', 'ab'), False)\n",
" assert_equal(solution.match_note_to_magazine('aa', 'aab'), True)\n",
" self.assertRaises(TypeError, solution.match_note_to_magazine, None, None)\n",
" self.assertEqual(solution.match_note_to_magazine('', ''), True)\n",
" self.assertEqual(solution.match_note_to_magazine('a', 'b'), False)\n",
" self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False)\n",
" self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True)\n",
" print('Success: test_ransom_note')\n",
"\n",
"\n",
@@ -160,9 +156,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -193,9 +187,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,15 +1,15 @@
from nose.tools import assert_equal, assert_raises
import unittest
class TestRansomNote(object):
class TestRansomNote(unittest.TestCase):
def test_ransom_note(self):
solution = Solution()
assert_raises(TypeError, solution.match_note_to_magazine, None, None)
assert_equal(solution.match_note_to_magazine('', ''), True)
assert_equal(solution.match_note_to_magazine('a', 'b'), False)
assert_equal(solution.match_note_to_magazine('aa', 'ab'), False)
assert_equal(solution.match_note_to_magazine('aa', 'aab'), True)
self.assertRaises(TypeError, solution.match_note_to_magazine, None, None)
self.assertEqual(solution.match_note_to_magazine('', ''), True)
self.assertEqual(solution.match_note_to_magazine('a', 'b'), False)
self.assertEqual(solution.match_note_to_magazine('aa', 'ab'), False)
self.assertEqual(solution.match_note_to_magazine('aa', 'aab'), True)
print('Success: test_ransom_note')
@@ -19,4 +19,4 @@ def main():
if __name__ == '__main__':
main()
main()