(self)
| 62 | np.testing.assert_allclose(result[0], np.stack([test_data1, test_data2])) |
| 63 | |
| 64 | def test_npz3(self): |
| 65 | test_data1 = np.random.randint(0, 256, size=[3, 4, 4]) |
| 66 | test_data2 = np.random.randint(0, 256, size=[3, 4, 4]) |
| 67 | with tempfile.TemporaryDirectory() as tempdir: |
| 68 | filepath = os.path.join(tempdir, "test_data.npz") |
| 69 | np.savez(filepath, test1=test_data1, test2=test_data2) |
| 70 | |
| 71 | reader = NumpyReader(npz_keys=["test1", "test2"]) |
| 72 | result = reader.get_data(reader.read(filepath)) |
| 73 | np.testing.assert_allclose(result[1]["spatial_shape"], test_data1.shape) |
| 74 | np.testing.assert_allclose(result[0].shape, (2, 3, 4, 4)) |
| 75 | np.testing.assert_allclose(result[0], np.stack([test_data1, test_data2])) |
| 76 | |
| 77 | def test_npy_pickle(self): |
| 78 | test_data = {"test": np.random.randint(0, 256, size=[3, 4, 4])} |
nothing calls this directly
no test coverage detected