コード例 #1
0
ファイル: test_collections.py プロジェクト: blaze/blaze
def test_concat_table():
    a = symbol('a', '3 * {a: int32, b: int32}')
    b = symbol('a', '5 * {a: int32, b: int32}')
    v = symbol('v', 'var * {a: int32, b: int32}')

    assert concat(a, b).dshape == dshape('8 * {a: int32, b: int32}')
    assert concat(a, v).dshape == dshape('var * {a: int32, b: int32}')
コード例 #2
0
ファイル: test_collections.py プロジェクト: blaze/blaze
def test_concat_arr():
    a = symbol('a', '3 * int32')
    b = symbol('b', '5 * int32')
    v = symbol('v', 'var * int32')

    assert concat(a, b).dshape == dshape('8 * int32')
    assert concat(a, v).dshape == dshape('var * int32')
コード例 #3
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_arr():
    a = symbol('a', '3 * int32')
    b = symbol('b', '5 * int32')
    v = symbol('v', 'var * int32')

    assert concat(a, b).dshape == dshape('8 * int32')
    assert concat(a, v).dshape == dshape('var * int32')
コード例 #4
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_table():
    a = symbol('a', '3 * {a: int32, b: int32}')
    b = symbol('a', '5 * {a: int32, b: int32}')
    v = symbol('v', 'var * {a: int32, b: int32}')

    assert concat(a, b).dshape == dshape('8 * {a: int32, b: int32}')
    assert concat(a, v).dshape == dshape('var * {a: int32, b: int32}')
コード例 #5
0
def test_concat_axis_too_great():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')

    with pytest.raises(ValueError) as excinfo:
        concat(a, b, axis=2)

    assert "must be in range: [0, 2)" in str(excinfo.value)
コード例 #6
0
ファイル: test_collections.py プロジェクト: blaze/blaze
def test_concat_axis_too_great():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')

    with pytest.raises(ValueError) as excinfo:
        concat(a, b, axis=2)

    assert "must be in range: [0, 2)" in str(excinfo.value)
コード例 #7
0
def test_concat_different_measure():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * float64')

    with pytest.raises(TypeError) as excinfo:
        concat(a, b)

    msg = 'Mismatched measures: {l} != {r}'.format(l=a.dshape.measure,
                                                   r=b.dshape.measure)
    assert msg == str(excinfo.value)
コード例 #8
0
ファイル: test_collections.py プロジェクト: blaze/blaze
def test_concat_mat():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')
    v = symbol('v', 'var * 5 * int32')
    u = symbol('u', '3 * var * int32')

    assert concat(a, b, axis=0).dshape == dshape('6 * 5 * int32')
    assert concat(a, b, axis=1).dshape == dshape('3 * 10 * int32')
    assert concat(a, v, axis=0).dshape == dshape('var * 5 * int32')
    assert concat(a, u, axis=1).dshape == dshape('3 * var * int32')
コード例 #9
0
ファイル: test_collections.py プロジェクト: blaze/blaze
def test_concat_different_measure():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * float64')

    with pytest.raises(TypeError) as excinfo:
        concat(a, b)

    msg = 'Mismatched measures: {l} != {r}'.format(l=a.dshape.measure,
                                                   r=b.dshape.measure)
    assert msg == str(excinfo.value)
コード例 #10
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_mat():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')
    v = symbol('v', 'var * 5 * int32')
    u = symbol('u', '3 * var * int32')

    assert concat(a, b, axis=0).dshape == dshape('6 * 5 * int32')
    assert concat(a, b, axis=1).dshape == dshape('3 * 10 * int32')
    assert concat(a, v, axis=0).dshape == dshape('var * 5 * int32')
    assert concat(a, u, axis=1).dshape == dshape('3 * var * int32')
コード例 #11
0
ファイル: test_collections.py プロジェクト: blaze/blaze
def test_concat_different_along_concat_axis():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 6 * int32')

    with pytest.raises(TypeError) as excinfo:
        concat(a, b, axis=0)

    assert "not equal along axis 1: 5 != 6" in str(excinfo.value)

    b = symbol('b', '4 * 6 * int32')
    with pytest.raises(TypeError) as excinfo:
        concat(a, b, axis=1)

    assert "not equal along axis 0: 3 != 4" in str(excinfo.value)
コード例 #12
0
def test_concat_different_along_concat_axis():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 6 * int32')

    with pytest.raises(TypeError) as excinfo:
        concat(a, b, axis=0)

    assert "not equal along axis 1: 5 != 6" in str(excinfo.value)

    b = symbol('b', '4 * 6 * int32')
    with pytest.raises(TypeError) as excinfo:
        concat(a, b, axis=1)

    assert "not equal along axis 0: 3 != 4" in str(excinfo.value)
コード例 #13
0
ファイル: test_collections.py プロジェクト: Webs234/blaze
def test_concat_different_measure():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * float64')

    with pytest.raises(TypeError):
        concat(a, b)
コード例 #14
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_axis_too_great():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')

    with pytest.raises(ValueError):
        concat(a, b, axis=2)
コード例 #15
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_negative_axis():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')

    with pytest.raises(ValueError):
        concat(a, b, axis=-1)
コード例 #16
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_different_along_concat_axis():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 6 * int32')

    with pytest.raises(TypeError):
        concat(a, b, axis=0)
コード例 #17
0
ファイル: test_collections.py プロジェクト: nkhuyu/blaze
def test_concat_different_measure():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * float64')

    with pytest.raises(TypeError):
        concat(a, b)
コード例 #18
0
ファイル: test_collections.py プロジェクト: Webs234/blaze
def test_concat_negative_axis():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')

    with pytest.raises(ValueError):
        concat(a, b, axis=-1)
コード例 #19
0
ファイル: test_collections.py プロジェクト: Webs234/blaze
def test_concat_axis_too_great():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 5 * int32')

    with pytest.raises(ValueError):
        concat(a, b, axis=2)
コード例 #20
0
ファイル: test_collections.py プロジェクト: Webs234/blaze
def test_concat_different_along_concat_axis():
    a = symbol('a', '3 * 5 * int32')
    b = symbol('b', '3 * 6 * int32')

    with pytest.raises(TypeError):
        concat(a, b, axis=0)