Ejemplo n.º 1
0
    def test_constructor(self):

        # missing data arg
        with pytest.raises(TypeError):
            # noinspection PyArgumentList
            AlleleCountsDaskArray()

        # data has wrong dtype
        data = 'foo bar'
        with pytest.raises(TypeError):
            AlleleCountsDaskArray(data)

        # data has wrong dtype
        data = np.array([4., 5., 3.7])
        with pytest.raises(TypeError):
            AlleleCountsDaskArray(data)

        # data has wrong dimensions
        data = np.array([1, 2, 3])
        with pytest.raises(TypeError):
            AlleleCountsDaskArray(data)

        # data has wrong dimensions
        data = np.array([[[1, 2], [3, 4]]])
        with pytest.raises(TypeError):
            AlleleCountsDaskArray(data)

        # valid data (typed)
        hd = self.setup_instance(np.array(allele_counts_data, dtype='u2'))
        aeq(allele_counts_data, hd)
        assert np.uint16 == hd.dtype
Ejemplo n.º 2
0
 def setup_instance(self, data):
     z = zarr.array(data, chunks=(2, None))
     return AlleleCountsDaskArray(z)