# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..utils import ThresholdImage


def test_ThresholdImage_inputs():
    input_map = dict(
        args=dict(
            argstr="%s",
        ),
        copy_header=dict(
            mandatory=True,
            usedefault=True,
        ),
        dimension=dict(
            argstr="%d",
            position=1,
            usedefault=True,
        ),
        environ=dict(
            nohash=True,
            usedefault=True,
        ),
        input_image=dict(
            argstr="%s",
            extensions=None,
            mandatory=True,
            position=2,
        ),
        input_mask=dict(
            argstr="%s",
            extensions=None,
            requires=["num_thresholds"],
        ),
        inside_value=dict(
            argstr="%f",
            position=6,
            requires=["th_low"],
        ),
        mode=dict(
            argstr="%s",
            position=4,
            requires=["num_thresholds"],
            xor=["th_low", "th_high"],
        ),
        num_threads=dict(
            nohash=True,
            usedefault=True,
        ),
        num_thresholds=dict(
            argstr="%d",
            position=5,
        ),
        output_image=dict(
            argstr="%s",
            extensions=None,
            keep_extension=True,
            name_source=["input_image"],
            name_template="%s_resampled",
            position=3,
        ),
        outside_value=dict(
            argstr="%f",
            position=7,
            requires=["th_low"],
        ),
        th_high=dict(
            argstr="%f",
            position=5,
            xor=["mode"],
        ),
        th_low=dict(
            argstr="%f",
            position=4,
            xor=["mode"],
        ),
    )
    inputs = ThresholdImage.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_ThresholdImage_outputs():
    output_map = dict(
        output_image=dict(
            extensions=None,
        ),
    )
    outputs = ThresholdImage.output_spec()

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