# Path: drain/step.py
# _STEP_CACHE = {}
#     DEFAULT = 1
# def load(steps, reload=False):
#     def __new__(cls, *args, **kwargs):
#     def __init__(self, inputs=None, dependencies=None, **kwargs):
#     def execute(self, inputs=None, output=None, load_targets=False):
#     def _hasher(self):
#     def _digest(self):
#     def get_input(self, value, _search=None):
#     def get_inputs(self, _visited=None):
#     def get_arguments(self, **include):
#     def _output_dirname(self):
#     def _yaml_filename(self):
#     def _dump_dirname(self):
#     def _target_filename(self):
#     def run(self):
#     def load(self):
#     def setup_dump(self):
#     def dump(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __init__(self, args=None, kwargs=None):
# def _simplify_arguments(arguments):
# def merge_results(inputs, arguments=None):
#     def __init__(self, step, key=None):
#     def run(self, *args, **kwargs):
#     def __init__(self, inputs, mapping):
#     def run(self, *args, **kwargs):
#     def __init__(self, _base, _method_name=None, inputs=None, **kwargs):
#     def run(self, *args, **update_kwargs):
# def _expand_inputs(step, steps=None):
# def _collect_kwargs(step, drop_duplicate_names=True):
# def _output_dirnames(workflow=None, leaf=False):
# class Step(object):
# class Arguments(object):
# class GetItem(Step):
# class MapResults(Step):
# class Call(Step):


from drain.step import *
from drain import step
import numpy as np
import tempfile

def test_dump_hdf_list():
    t = DumpStep(n=0, n_df=5, return_list=True)

    t.execute()
    r = t.result
    t.dump()
    t.load()

    for a,b in zip(r,t.result):
        assert a.equals(b)

def test_dump_hdf_dict():
    t = DumpStep(n=0, n_df=5, return_list=False)

    t.execute()
    r = t.result
    t.dump()
    t.load()

    for k in r:
        assert r[k].equals(t.result[k])

def test_expand_inputs():
    s = Step(a=1, b={'c':Step(c=2)})
    assert step._expand_inputs(s) == {s, Step(c=2)}

def test_collect_kwargs():
    s = Step(a=1, b={'c':Step(c=2)})
    s.name = 'Step2'

# Path: drain/step.py
# _STEP_CACHE = {}
#     DEFAULT = 1
# def load(steps, reload=False):
#     def __new__(cls, *args, **kwargs):
#     def __init__(self, inputs=None, dependencies=None, **kwargs):
#     def execute(self, inputs=None, output=None, load_targets=False):
#     def _hasher(self):
#     def _digest(self):
#     def get_input(self, value, _search=None):
#     def get_inputs(self, _visited=None):
#     def get_arguments(self, **include):
#     def _output_dirname(self):
#     def _yaml_filename(self):
#     def _dump_dirname(self):
#     def _target_filename(self):
#     def run(self):
#     def load(self):
#     def setup_dump(self):
#     def dump(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __init__(self, args=None, kwargs=None):
# def _simplify_arguments(arguments):
# def merge_results(inputs, arguments=None):
#     def __init__(self, step, key=None):
#     def run(self, *args, **kwargs):
#     def __init__(self, inputs, mapping):
#     def run(self, *args, **kwargs):
#     def __init__(self, _base, _method_name=None, inputs=None, **kwargs):
#     def run(self, *args, **update_kwargs):
# def _expand_inputs(step, steps=None):
# def _collect_kwargs(step, drop_duplicate_names=True):
# def _output_dirnames(workflow=None, leaf=False):
# class Step(object):
# class Arguments(object):
# class GetItem(Step):
# class MapResults(Step):
# class Call(Step):


# Path: tests/test_step.py
from drain.step import *
from drain import step
import numpy as np
import tempfile


def test_dump_hdf_list():
    t = DumpStep(n=0, n_df=5, return_list=True)

    t.execute()
    r = t.result
    t.dump()
    t.load()

    for a,b in zip(r,t.result):
        assert a.equals(b)

def test_dump_hdf_dict():
    t = DumpStep(n=0, n_df=5, return_list=False)

    t.execute()
    r = t.result
    t.dump()
    t.load()

    for k in r:
        assert r[k].equals(t.result[k])

def test_expand_inputs():
    s = Step(a=1, b={'c':Step(c=2)})
    assert step._expand_inputs(s) == {s, Step(c=2)}

def test_collect_kwargs():
    s = Step(a=1, b={'c':Step(c=2)})
    s.name = 'Step2'

    assert step._collect_kwargs(s) == {