Esempio n. 1
0
def test_balance_right():
    """Test that a right side is larger and returns a negative int."""
    from bst import Node
    a = Node(20)
    a.right = Node(23)
    assert a.balance() == -1
Esempio n. 2
0
def test_balance_one():
    """Test that a node of one returns a depth of one."""
    from bst import Node
    a = Node(1)
    assert a.balance() == 0
Esempio n. 3
0
def test_balance_left():
    """Test that a left side is larger and returns a positive int."""
    from bst import Node
    a = Node(20)
    a.left = Node(18)
    assert a.balance() == 1
Esempio n. 4
0
def test_balance_none():
    """Test that a node of nothing returns a value of nothing."""
    from bst import Node
    a = Node()
    assert a.balance() == 0