| 137 | |
| 138 | @raises(RuntimeError, "Got bad magic string for numpy header") |
| 139 | def test_raise_bad_numpy_magic(): |
| 140 | def bad_source(): |
| 141 | yield (np.zeros(100, dtype=np.uint8),) |
| 142 | |
| 143 | @pipeline_def(batch_size=1, num_threads=1) |
| 144 | def pipe(): |
| 145 | encoded_npy = fn.external_source( |
| 146 | source=bad_source(), num_outputs=1, batch=False, ndim=1, dtype=DALIDataType.UINT8 |
| 147 | ) |
| 148 | decoded = fn.decoders.numpy(encoded_npy) |
| 149 | return decoded |
| 150 | |
| 151 | p = pipe() |
| 152 | p.build() |
| 153 | p.run() |
| 154 | |
| 155 | |
| 156 | @raises(RuntimeError, "All samples in the dataset must have the same data type") |