<commit_before>import os

from nipype.testing import *
import nipype.interfaces.fsl as fsl


def test_fslversion():
    ver = fsl.fslversion().split('.')
    yield assert_equal, ver[0], '4'

    
def test_fsloutputtype():
    types = ['ANALYZE_GZ', 'NIFTI_PAIR_GZ', 'NIFTI', 'NIFTI_PAIR',
             'NIFTI_GZ', 'ANALYZE']
    out_type, ext = fsl.fsloutputtype()
    yield assert_true, out_type in types
    env_type = os.environ.get('FSLOUTPUTTYPE')
    if env_type:
        # Set to same value for test.
        out_type, ext = fsl.fsloutputtype(env_type)
        yield assert_equal, out_type, env_type


def test_FSLCommand():
    # Most methods in FSLCommand are tested in the subclasses.  Only
    # testing the one item that is not.
    cmd = fsl.FSLCommand()
    cmd.cmd = 'bet' # Set the cmd to something
    res = cmd.run()
    yield assert_equal, type(res), fsl.InterfaceResult
    

# test Bet
def test_bet():
    better = fsl.Bet()
    yield assert_equal, better.cmd, 'bet'
<commit_msg>Fix fsl test so it doesn't error if fsl is not installed.<commit_after>import os

from nipype.testing import *
import nipype.interfaces.fsl as fsl


def test_fslversion():
    ver = fsl.fslversion()
    if ver:
        # If ver is None, fsl is not installed
        ver = ver.split('.')
        yield assert_equal, ver[0], '4'

    
def test_fsloutputtype():
    types = ['ANALYZE_GZ', 'NIFTI_PAIR_GZ', 'NIFTI', 'NIFTI_PAIR',
             'NIFTI_GZ', 'ANALYZE']
    out_type, ext = fsl.fsloutputtype()
    yield assert_true, out_type in types
    env_type = os.environ.get('FSLOUTPUTTYPE')
    if env_type:
        # Set to same value for test.
        out_type, ext = fsl.fsloutputtype(env_type)
        yield assert_equal, out_type, env_type


def test_FSLCommand():
    # Most methods in FSLCommand are tested in the subclasses.  Only
    # testing the one item that is not.
    cmd = fsl.FSLCommand()
    cmd.cmd = 'bet' # Set the cmd to something
    res = cmd.run()
    yield assert_equal, type(res), fsl.InterfaceResult
    

# test Bet
def test_bet():
    better = fsl.Bet()
    yield assert_equal, better.cmd, 'bet'

{'fraction_non_alphanumeric': 0.1063529411764706, 'fraction_numerical': 0.0018823529411764706, 'mean_word_length': 2.9443413729128016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5610861', 'n_tokens_mistral': 760, 'n_tokens_neox': 750, 'n_words': 213}