# Path: eppy/walk_hvac.py
# def nextnode(edges, component):
# def prevnode(edges, component):
# def main():


from eppy import walk_hvac
        ("SPACE1-1 VAV Reheat", "SPACE1-1 ATU"),
        ("SPACE2-1 VAV Reheat", "SPACE2-1 ATU"),
        ("SPACE3-1 VAV Reheat", "SPACE3-1 ATU"),
        ("SPACE4-1 VAV Reheat", "SPACE4-1 ATU"),
        ("SPACE5-1 VAV Reheat", "SPACE5-1 ATU"),
    )
    for comp, nextcomp in connections:
        result = walk_hvac.nextnode(edges, comp)
        assert result == [nextcomp]


def test_prevnode():
    """py.test for prevnode"""
    edges = e1
    prevs = [
        "sb4_pipe",
        "p_loop_supply_mixer",
        "sb1_pipe",
        "p_loop_supply_splitter",
        "np2",
        "np1",
        "Central_Chiller",
    ]

    c = "sb4_pipe"
    i = 0
    n = 0
    while n == 0:
        assert prevs[i] == c
        i += 1

# Path: eppy/walk_hvac.py
# def nextnode(edges, component):
# def prevnode(edges, component):
# def main():


# Path: tests/test_walk_hvac.py
from eppy import walk_hvac

        ("SPACE1-1 VAV Reheat", "SPACE1-1 ATU"),
        ("SPACE2-1 VAV Reheat", "SPACE2-1 ATU"),
        ("SPACE3-1 VAV Reheat", "SPACE3-1 ATU"),
        ("SPACE4-1 VAV Reheat", "SPACE4-1 ATU"),
        ("SPACE5-1 VAV Reheat", "SPACE5-1 ATU"),
    )
    for comp, nextcomp in connections:
        result = walk_hvac.nextnode(edges, comp)
        assert result == [nextcomp]


def test_prevnode():
    """py.test for prevnode"""
    edges = e1
    prevs = [
        "sb4_pipe",
        "p_loop_supply_mixer",
        "sb1_pipe",
        "p_loop_supply_splitter",
        "np2",
        "np1",
        "Central_Chiller",
    ]

    c = "sb4_pipe"
    i = 0
    n = 0
    while n == 0:
        assert prevs[i] == c
        i += 1

        prevcs = walk_hvac.prevnode(edges, c)