Exemple #1
0
def test_coerce_to_dict_with_list_of_lists():
    test_input = [[0, 0, 1], [0, 1, 0]]
    expected_output = {
        '[0, 0, 1]': [0, 0, 1],
        '[0, 1, 0]': [0, 1, 0],
    }
    actual_output = glmr._coerce_to_dict(test_input)
    assert actual_output == expected_output
Exemple #2
0
def test_coerce_to_dict_with_list_of_strings():
    test_input = ['contrast_name_0', 'contrast_name_1']
    expected_output = {
        'contrast_name_0': 'contrast_name_0',
        'contrast_name_1': 'contrast_name_1',
    }
    actual_output = glmr._coerce_to_dict(test_input)
    assert actual_output == expected_output
def test_coerce_to_dict_with_list_of_ints():
    test_input = [1, 0, 1]
    expected_output = {'[1, 0, 1]': [1, 0, 1]}
    actual_output = glmr._coerce_to_dict(test_input)
    assert np.array_equal(
        actual_output['[1, 0, 1]'],
        expected_output['[1, 0, 1]'],
    )
Exemple #4
0
def test_coerce_to_dict_with_array_of_ints():
    test_input = np.array([1, 0, 1])
    expected_output = {'[1 0 1]': np.array([1, 0, 1])}
    actual_output = glmr._coerce_to_dict(test_input)
    assert expected_output.keys() == actual_output.keys()
    assert np.array_equal(
        actual_output['[1 0 1]'],
        expected_output['[1 0 1]'],
    )
Exemple #5
0
def test_coerce_to_dict_with_dict():
    test_input = {
        'contrast_0': [0, 0, 1],
        'contrast_1': [0, 1, 1],
    }
    expected_output = {
        'contrast_0': [0, 0, 1],
        'contrast_1': [0, 1, 1],
    }
    actual_output = glmr._coerce_to_dict(test_input)
    assert actual_output == expected_output
Exemple #6
0
def test_coerce_to_dict_with_list_of_arrays():
    test_input = [np.array([0, 0, 1]), np.array([0, 1, 0])]
    expected_output = {
        '[0 0 1]': np.array([0, 0, 1]),
        '[0 1 0]': np.array([0, 1, 0]),
    }
    actual_output = glmr._coerce_to_dict(test_input)
    assert actual_output.keys() == expected_output.keys()
    for key in actual_output:
        assert np.array_equal(
            actual_output[key],
            expected_output[key],
        )
Exemple #7
0
def test_coerce_to_dict_with_string():
    test_input = 'StopSuccess - Go'
    expected_output = {'StopSuccess - Go': 'StopSuccess - Go'}
    actual_output = glmr._coerce_to_dict(test_input)
    assert actual_output == expected_output