예제 #1
0
def test_transpose_rowcol_2d(type_func):
    matrix = type_func([['s1t1', 's1t2'], ['s2t1', 's2t2']])

    assert helpers.fix_numpy_array_equality(
        multioutputs._transpose_rowcol(matrix) ==
        helpers.fix_numpy_array_equality(
            type_func([('s1t1', 's2t1'), ('s1t2', 's2t2')])))
예제 #2
0
def test_transpose_rowcol_1d(type_func):
    # Should cause no change
    matrix = type_func(['s1t1', 's2t1'])

    assert helpers.fix_numpy_array_equality(
        multioutputs._transpose_rowcol(matrix) ==
        helpers.fix_numpy_array_equality(type_func(['s1t1', 's2t1'])))
예제 #3
0
def test_transpose_rowcol_3d(type_func):
    matrix = type_func([[['s1t11', 's1t12'], ['s1t21', 's1t22']],
                        [['s2t11', 's2t12'], ['s2t21', 's2t22']]])

    assert helpers.fix_numpy_array_equality(
        multioutputs._transpose_rowcol(matrix) ==
        helpers.fix_numpy_array_equality(
            type_func([(
                ['s1t11', 's1t12'],
                ['s2t11', 's2t12']), (['s1t21', 's1t22'],
                                      ['s2t21', 's2t22'])])))
예제 #4
0
def test_transpose_rowcol_2d_list_of_arrays():
    matrix = [numpy.array(['s1t1', 's1t2']), numpy.array(['s2t1', 's2t2'])]

    assert helpers.fix_numpy_array_equality(
        multioutputs._transpose_rowcol(matrix) ==
        helpers.fix_numpy_array_equality([('s1t1', 's2t1'), ('s1t2', 's2t2')]))