def test_array_from_query(): x = sdb.ones(4) q = sdb.afl.apply(x, 'g', 'f0 + 3').query array = SciDBArray.from_query(sdb, q) assert array.shape == x.shape assert_allclose(x.toarray(), array.toarray()['f0']) assert_allclose(x.toarray() + 3, array.toarray()['g'])
def test_array_eval(): x = sdb.ones(4) q = sdb.afl.apply(x, 'g', 'f0 + 3').query array = SciDBArray.from_query(sdb, q) assert array.name == q array.eval() assert array.name != q expected = array.toarray() np.testing.assert_array_equal(expected, array.toarray())