mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 02:48:02 +00:00
Polish bst check balanced challenge and solution (#84)
Update constraints, tests, and code.
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user