def test_append_other(): b = carray(x) append(b, convert(list, x)) assert len(b) == 2 * len(x)
def test_convert(): assert isinstance(convert(carray, np.ones([1, 2, 3])), carray) b = carray([1, 2, 3]) assert isinstance(convert(np.ndarray, b), np.ndarray)
def test_append_chunks(): b = carray(x) append(b, chunks(np.ndarray)([x, x])) assert len(b) == len(x) * 3
discover, drop) from into.chunks import chunks from into import append, convert, discover, into import numpy as np from into.utils import tmpfile import os def eq(a, b): c = a == b if isinstance(c, np.ndarray): c = c.all() return c a = carray([1, 2, 3, 4]) x = np.array([1, 2]) def test_discover(): assert discover(a) == discover(a[:]) def test_convert(): assert isinstance(convert(carray, np.ones([1, 2, 3])), carray) b = carray([1, 2, 3]) assert isinstance(convert(np.ndarray, b), np.ndarray) def test_chunks(): c = convert(chunks(np.ndarray), a, chunksize=2)