Update tree check balance challenge (#120)

Use more specific exception types.
This commit is contained in:
Donne Martin 2016-11-17 05:38:28 -05:00 committed by GitHub
parent a0944eb5f4
commit 14de5e4233
3 changed files with 4 additions and 4 deletions

View File

@ -128,7 +128,7 @@
"\n",
"class TestCheckBalance(object):\n",
"\n",
" @raises(Exception)\n",
" @raises(TypeError)\n",
" def test_check_balance_empty(self):\n",
" bst = BstBalance(None)\n",
" bst.check_balance()\n",

View File

@ -120,7 +120,7 @@
"\n",
" def check_balance(self):\n",
" if self.root is None:\n",
" raise Exception('No root node')\n",
" raise TypeError('root cannot be None')\n",
" height = self._check_height(self.root)\n",
" return height != -1"
]
@ -155,7 +155,7 @@
"\n",
"class TestCheckBalance(object):\n",
"\n",
" @raises(Exception)\n",
" @raises(TypeError)\n",
" def test_check_balance_empty(self):\n",
" bst = BstBalance(None)\n",
" bst.check_balance()\n",

View File

@ -4,7 +4,7 @@ from nose.tools import raises
class TestCheckBalance(object):
@raises(Exception)
@raises(TypeError)
def test_check_balance_empty(self):
bst = BstBalance(None)
bst.check_balance()