Пример #1
0
def test_transform_array_force_list_default_with_buffers(dt) -> None:
    a = np.empty(shape=10, dtype=dt)
    bufs = []
    out = bus.transform_array(a, buffers=bufs)
    assert isinstance(out, dict)
    assert len(bufs) == 1
    assert len(bufs[0]) == 2
    assert bufs[0][1] == a.tobytes()
    assert 'shape' in out
    assert out['shape'] == a.shape
    assert 'dtype' in out
    assert out['dtype'] == a.dtype.name
    assert '__buffer__' in out
Пример #2
0
def test_transform_array_force_list_default_with_buffers(dt):
    a = np.empty(shape=10, dtype=dt)
    bufs = []
    out = bus.transform_array(a, buffers=bufs)
    assert isinstance(out, dict)
    assert len(bufs) == 1
    assert len(bufs[0]) == 2
    assert bufs[0][1] == a.tobytes()
    assert 'shape' in out
    assert out['shape'] == a.shape
    assert 'dtype' in out
    assert out['dtype'] == a.dtype.name
    assert '__buffer__' in out
Пример #3
0
def test_transform_array_force_list_true(dt) -> None:
    a = np.empty(shape=10, dtype=dt)
    out = bus.transform_array(a, force_list=True)
    assert isinstance(out, list)
Пример #4
0
def test_transform_array_force_list_default(dt) -> None:
    a = np.empty(shape=10, dtype=dt)
    out = bus.transform_array(a)
    assert isinstance(out, dict)
Пример #5
0
def test_transform_array_force_list_true():
    dt_ok = bus.BINARY_ARRAY_TYPES
    for dt in dt_ok:
        a = np.empty(shape=10, dtype=dt)
        out = bus.transform_array(a, force_list=True)
        assert isinstance(out, list)
Пример #6
0
def test_transform_array_force_list_true():
    dt_ok = bus.BINARY_ARRAY_TYPES
    for dt in dt_ok:
        a = np.empty(shape=10, dtype=dt)
        out = bus.transform_array(a, force_list=True)
        assert isinstance(out, list)
Пример #7
0
def test_transform_array_force_list_true(dt):
    a = np.empty(shape=10, dtype=dt)
    out = bus.transform_array(a, force_list=True)
    assert isinstance(out, list)
Пример #8
0
def test_transform_array_force_list_default(dt):
    a = np.empty(shape=10, dtype=dt)
    out = bus.transform_array(a)
    assert isinstance(out, dict)
Пример #9
0
def test_transform_array(dt) -> None:
    a = np.empty(shape=10, dtype=dt)
    out = bus.transform_array(a)
    assert isinstance(out, np.ndarray)