def test_FSLCommand2(): # Check default output type and environ cmd = fsl.FSLCommand(command="junk") assert cmd._output_type == fsl.Info.output_type() assert cmd.inputs.environ["FSLOUTPUTTYPE"] == cmd._output_type assert cmd._output_type in fsl.Info.ftypes cmd = fsl.FSLCommand cmdinst = fsl.FSLCommand(command="junk") for out_type in fsl.Info.ftypes: cmd.set_default_output_type(out_type) assert cmd._output_type == out_type if out_type != fsl.Info.output_type(): # Setting class outputtype should not effect existing instances assert cmdinst.inputs.output_type != out_type
def test_FSLCommand2(): # Check default output type and environ cmd = fsl.FSLCommand(command='junk') yield assert_equal, cmd._output_type, fsl.Info.output_type() yield assert_equal, cmd.inputs.environ['FSLOUTPUTTYPE'], cmd._output_type yield assert_true, cmd._output_type in fsl.Info.ftypes cmd = fsl.FSLCommand cmdinst = fsl.FSLCommand(command='junk') for out_type in fsl.Info.ftypes: cmd.set_default_output_type(out_type) yield assert_equal, cmd._output_type, out_type if out_type != fsl.Info.output_type(): # Setting class outputtype should not effect existing instances yield assert_not_equal, cmdinst.inputs.output_type, out_type
def test_gen_fname(args, desired_name): # Test _gen_fname method of FSLCommand cmd = fsl.FSLCommand(command="junk", output_type="NIFTI_GZ") pth = os.getcwd() fname = cmd._gen_fname("foo.nii.gz", **args) if "dir" in desired_name.keys(): desired = os.path.join(desired_name["dir"], desired_name["file"]) else: desired = os.path.join(pth, desired_name["file"]) assert fname == desired
def test_gen_fname(): # Test _gen_fname method of FSLCommand cmd = fsl.FSLCommand(command='junk', output_type='NIFTI_GZ') pth = os.getcwd() # just the filename fname = cmd._gen_fname('foo.nii.gz', suffix='_fsl') desired = os.path.join(pth, 'foo_fsl.nii.gz') yield assert_equal, fname, desired # filename with suffix fname = cmd._gen_fname('foo.nii.gz', suffix='_brain') desired = os.path.join(pth, 'foo_brain.nii.gz') yield assert_equal, fname, desired # filename with suffix and working directory fname = cmd._gen_fname('foo.nii.gz', suffix='_brain', cwd='/data') desired = os.path.join('/data', 'foo_brain.nii.gz') yield assert_equal, fname, desired # filename with suffix and no file extension change fname = cmd._gen_fname('foo.nii.gz', suffix='_brain.mat', change_ext=False) desired = os.path.join(pth, 'foo_brain.mat') yield assert_equal, fname, desired
def test_FSLCommand(): # Most methods in FSLCommand are tested in the subclasses. Only # testing the one item that is not. cmd = fsl.FSLCommand(command="ls") res = cmd.run() assert type(res) == InterfaceResult
def test_FSLCommand(): # Most methods in FSLCommand are tested in the subclasses. Only # testing the one item that is not. cmd = fsl.FSLCommand(command='ls') res = cmd.run() yield assert_equal, type(res), InterfaceResult