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
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
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)
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)
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)
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)
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)
def test_transform_array_force_list_default(dt): a = np.empty(shape=10, dtype=dt) out = bus.transform_array(a) assert isinstance(out, dict)
def test_transform_array(dt) -> None: a = np.empty(shape=10, dtype=dt) out = bus.transform_array(a) assert isinstance(out, np.ndarray)