import collections

import pytest

from fixtures import test_net

_data = collections.OrderedDict()
_data['depth_first=False,first_only=True'] =  ({'depth_first': False, 'first_only': True}, 
                                          ['i0', 'i1', 't0', 't1', 'p0_0', 'p1_0', 'p1_1', 't2', 'o0'])
_data['depth_first=True,first_only=True'] =   ({'depth_first': True, 'first_only': True}, 
                                          ['i0', 't0', 'p0_0', 't1', 'p1_0', 't2', 'o0', 'p1_1', 'i1'])
_data['depth_first=False,first_only=False'] = ({'depth_first': False, 'first_only': False}, 
                                          ['i0', 'i1', 't0', 't1', 't0', 'p0_0', 'p1_0', 'p1_1', 'p0_0', 't1', 't2', 't2', 't2', 't1', 't2', 'p1_0', 'p1_1', 'o0', 'o0', 'o0', 'p1_0', 'p1_1', 'o0', 't2', 't2', 't2', 't2', 'o0', 'o0', 'o0', 'o0'])
_data['depth_first=True,first_only=False'] =  ({'depth_first': True, 'first_only': False}, 
                                          ['i0', 't0', 'p0_0', 't1', 'p1_0', 't2', 'o0', 'p1_1', 't2', 'o0', 't2', 'o0', 't1', 'p1_0', 't2', 'o0', 'p1_1', 't2', 'o0', 'i1', 't0', 'p0_0', 't1', 'p1_0', 't2', 'o0', 'p1_1', 't2', 'o0', 't2', 'o0'])

@pytest.fixture(params=tuple(_data.values()), ids=tuple(_data.keys()))
def walk_test(request):
    return request.param

def test_net_walk(test_net, walk_test):
    kwargs, result = walk_test
    names = [node.name for node in test_net.walk(**kwargs)]
    assert names == result
