(self)
| 73 | np.testing.assert_allclose(out, img_save_val) |
| 74 | |
| 75 | def test_write_2channels(self): |
| 76 | with tempfile.TemporaryDirectory() as out_dir: |
| 77 | image_name = os.path.join(out_dir, "test.png") |
| 78 | img = np.random.rand(2, 3, 2) |
| 79 | img_save_val = (255 * img).astype(np.uint8) |
| 80 | writer_obj = PILWriter(output_dtype=np.uint8) |
| 81 | writer_obj.set_data_array(img, channel_dim=-1) |
| 82 | writer_obj.write(image_name, format="PNG") |
| 83 | out = np.asarray(Image.open(image_name)) |
| 84 | out = np.moveaxis(out, 0, 1) |
| 85 | np.testing.assert_allclose(out, img_save_val) |
| 86 | |
| 87 | def test_write_output_shape(self): |
| 88 | with tempfile.TemporaryDirectory() as out_dir: |
nothing calls this directly
no test coverage detected