mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 10:58:02 +00:00
@@ -1,11 +1,11 @@
|
||||
from nose.tools import assert_equal, assert_raises
|
||||
import unittest
|
||||
|
||||
|
||||
class TestBstSecondLargest(object):
|
||||
class TestBstSecondLargest(unittest.TestCase):
|
||||
|
||||
def test_bst_second_largest(self):
|
||||
bst = Solution(None)
|
||||
assert_raises(TypeError, bst.find_second_largest)
|
||||
self.assertRaises(TypeError, bst.find_second_largest)
|
||||
root = Node(10)
|
||||
bst = Solution(root)
|
||||
node5 = bst.insert(5)
|
||||
@@ -17,13 +17,13 @@ class TestBstSecondLargest(object):
|
||||
node2 = bst.insert(2)
|
||||
node4 = bst.insert(4)
|
||||
node30 = bst.insert(30)
|
||||
assert_equal(bst.find_second_largest(), node20)
|
||||
self.assertEqual(bst.find_second_largest(), node20)
|
||||
root = Node(10)
|
||||
bst = Solution(root)
|
||||
node5 = bst.insert(5)
|
||||
node3 = bst.insert(3)
|
||||
node7 = bst.insert(7)
|
||||
assert_equal(bst.find_second_largest(), node7)
|
||||
self.assertEqual(bst.find_second_largest(), node7)
|
||||
print('Success: test_bst_second_largest')
|
||||
|
||||
|
||||
@@ -33,4 +33,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user