(self)
| 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])} |
| 79 | with tempfile.TemporaryDirectory() as tempdir: |
| 80 | filepath = os.path.join(tempdir, "test_data.npy") |
| 81 | np.save(filepath, test_data, allow_pickle=True) |
| 82 | |
| 83 | reader = NumpyReader() |
| 84 | |
| 85 | with self.assertRaises(ValueError): |
| 86 | reader.get_data(reader.read(filepath)) |
| 87 | |
| 88 | reader = NumpyReader(allow_pickle=True) |
| 89 | result = reader.get_data(reader.read(filepath))[0].item() |
| 90 | |
| 91 | np.testing.assert_allclose(result["test"].shape, test_data["test"].shape) |
| 92 | np.testing.assert_allclose(result["test"], test_data["test"]) |
| 93 | |
| 94 | def test_kwargs(self): |
| 95 | test_data = {"test": np.random.randint(0, 256, size=[3, 4, 4])} |
nothing calls this directly
no test coverage detected