Esempio n. 1
0
def setup_nodes():
    left = Node("left")
    right = Node("right")
    left.left = right
    left.right = right
    right.left = left
    right.right = left
    midleft = insert_data(left, right, "midleft")
    midright = insert_data(midleft, right, "midright")
    verify_links([(right, left), (left, midleft), (midleft, midright), (midright, right)])
    return (left, midleft, midright, right)
Esempio n. 2
0
def test_right_type_not_equal():
    node = Node()
    with pytest.raises(ValueError):
        badright = "string"
        node.right = badright
    assert(node.right is None)
Esempio n. 3
0
def test_verify_link_negative_right():
    left = Node("left")
    right = Node("right")
    left.right = right
    with pytest.raises(AssertionError):
        verify_link(left, right)
Esempio n. 4
0
def test_right_type_equal():
    node = Node("parent")
    right = Node("right")
    node.right = right
    assert(node.right is right)