Polish bst check balanced challenge and solution (#84)

Update constraints, tests, and code.
This commit is contained in:
Donne Martin
2016-06-25 22:13:15 -04:00
committed by GitHub
parent 589ff06b15
commit d3fd7bc0a1
3 changed files with 23 additions and 10 deletions

View File

@@ -1,11 +1,14 @@
from nose.tools import assert_equal
from nose.tools import raises
class TestCheckBalance(object):
def test_check_balance(self):
assert_equal(check_balance(None), False)
@raises(Exception)
def test_check_balance_empty(self):
check_balance(None)
def test_check_balance(self):
node = Node(5)
assert_equal(check_balance(node), True)
@@ -36,6 +39,7 @@ class TestCheckBalance(object):
def main():
test = TestCheckBalance()
test.test_check_balance_empty()
test.test_check_balance()