예제 #1
0
def test_is_bst__nothing():
    assert is_bst(None)
예제 #2
0
def test_is_bst__not_at_all():
    root = BinaryNode(7, left=BinaryNode(9), right=BinaryNode(1))
    assert not is_bst(root)
예제 #3
0
def test_is_bst__simple():
    root = BinaryNode(2, left=BinaryNode(1), right=None)
    assert is_bst(root)
예제 #4
0
def test_is_bst__complex():
    root = to_bst([1, 2, 3, 4, 5, 6, 7, 8])
    assert is_bst(root)
예제 #5
0
def test_is_bst__one():
    assert is_bst(BinaryNode(1))