# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..preprocess import DWIPreproc


def test_DWIPreproc_inputs():
    input_map = dict(
        align_seepi=dict(
            argstr="-align_seepi",
        ),
        args=dict(
            argstr="%s",
        ),
        bval_scale=dict(
            argstr="-bvalue_scaling %s",
        ),
        eddy_options=dict(
            argstr='-eddy_options "%s"',
        ),
        environ=dict(
            nohash=True,
            usedefault=True,
        ),
        export_grad_fsl=dict(
            argstr="-export_grad_fsl",
        ),
        export_grad_mrtrix=dict(
            argstr="-export_grad_mrtrix",
        ),
        grad_file=dict(
            argstr="-grad %s",
            extensions=None,
            xor=["grad_fsl"],
        ),
        grad_fsl=dict(
            argstr="-fslgrad %s %s",
            xor=["grad_file"],
        ),
        in_bval=dict(
            extensions=None,
        ),
        in_bvec=dict(
            argstr="-fslgrad %s %s",
            extensions=None,
        ),
        in_epi=dict(
            argstr="-se_epi %s",
            extensions=None,
        ),
        in_file=dict(
            argstr="%s",
            extensions=None,
            mandatory=True,
            position=0,
        ),
        nthreads=dict(
            argstr="-nthreads %d",
            nohash=True,
        ),
        out_bval=dict(
            extensions=None,
        ),
        out_bvec=dict(
            argstr="-export_grad_fsl %s %s",
            extensions=None,
        ),
        out_file=dict(
            argstr="%s",
            extensions=None,
            mandatory=True,
            position=1,
            usedefault=True,
        ),
        out_grad_fsl=dict(
            argstr="%s, %s",
            requires=["export_grad_fsl"],
        ),
        out_grad_mrtrix=dict(
            argstr="%s",
            extensions=None,
            requires=["export_grad_mrtrix"],
            usedefault=True,
        ),
        pe_dir=dict(
            argstr="-pe_dir %s",
            mandatory=True,
        ),
        ro_time=dict(
            argstr="-readout_time %f",
        ),
        rpe_options=dict(
            argstr="-rpe_%s",
            mandatory=True,
            position=2,
        ),
        topup_options=dict(
            argstr='-topup_options "%s"',
        ),
    )
    inputs = DWIPreproc.input_spec()

    for key, metadata in list(input_map.items()):
        for metakey, value in list(metadata.items()):
            assert getattr(inputs.traits()[key], metakey) == value


def test_DWIPreproc_outputs():
    output_map = dict(
        out_file=dict(
            argstr="%s",
            extensions=None,
        ),
        out_fsl_bval=dict(
            argstr="%s",
            extensions=None,
            usedefault=True,
        ),
        out_fsl_bvec=dict(
            argstr="%s",
            extensions=None,
            usedefault=True,
        ),
        out_grad_mrtrix=dict(
            argstr="%s",
            extensions=None,
            usedefault=True,
        ),
    )
    outputs = DWIPreproc.output_spec()

    for key, metadata in list(output_map.items()):
        for metakey, value in list(metadata.items()):
            assert getattr(outputs.traits()[key], metakey) == value
