Skip to content

Commit

Permalink
Testing exceptions from ZarrToArray transformation
Browse files Browse the repository at this point in the history
Signed-off-by: Julio Faracco <[email protected]>
  • Loading branch information
jcfaracco committed Mar 29, 2024
1 parent fc8680d commit bd7a04a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/transforms/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ def test_zarr_to_array_cpu(self):

T_1 = T.transform(dataset)

print(type(T_1))

self.assertTrue(is_cpu_array(T_1))

def test_zarr_to_array_mcpu(self):
Expand All @@ -231,12 +229,24 @@ def test_zarr_to_array_mcpu(self):

T = ZarrToArray()

print(dataset._data)

T_1 = T.transform(dataset)

self.assertTrue(is_dask_cpu_array(T_1))

def test_zarr_to_array_wrong_input(self):
with self.assertRaises(Exception) as context:
dataset = DatasetArray(download=False, name="Test Zarr as an Array")

np.save(self.array, np.random.random(10))

dataset.from_array(np.load(self.array))

T = ZarrToArray()

T_1 = T.transform(dataset)

self.assertTrue('Input is not a Zarr dataset' in str(context.exception))

def tearDown(self):
self.remove(self.array)
self.remove(self.zarr)
Expand Down

0 comments on commit bd7a04a

Please sign in to comment.