def test_from_coo_valerr(a): with pytest.raises(ValueError): GCXS.from_coo(a, idx_dtype=np.int8)
def test_from_coo(a): assert_eq(a, GCXS(a))
def test_gcxs_valerr(): a = np.arange(300) with pytest.raises(ValueError): GCXS.from_numpy(a, idx_dtype=np.int8)
def test_change_compressed_axes(coo): s = GCXS.from_coo(coo, compressed_axes=(0, 1)) b = GCXS.from_coo(coo, compressed_axes=(1, 2)) assert_eq(s, b) s.change_compressed_axes((1, 2)) assert_eq(s, b)
def test_tocoo(coo): b = GCXS.from_coo(coo) assert_eq(b.tocoo(), coo)
def test_tocoo(): coo = sparse.random((5, 6), density=0.5) b = GCXS.from_coo(coo) assert_eq(b.tocoo(), coo)