(self)
| 24 | class TestPngWrite(unittest.TestCase): |
| 25 | |
| 26 | def test_write_gray(self): |
| 27 | with tempfile.TemporaryDirectory() as out_dir: |
| 28 | image_name = os.path.join(out_dir, "test.png") |
| 29 | img = np.random.rand(2, 3) |
| 30 | img_save_val = (255 * img).astype(np.uint8) |
| 31 | writer_obj = PILWriter(output_dtype=np.uint8) |
| 32 | writer_obj.set_data_array(img, channel_dim=None) |
| 33 | writer_obj.write(image_name, format="PNG") |
| 34 | out = np.asarray(Image.open(image_name)) |
| 35 | out = np.moveaxis(out, 0, 1) |
| 36 | np.testing.assert_allclose(out, img_save_val) |
| 37 | |
| 38 | def test_write_gray_1height(self): |
| 39 | with tempfile.TemporaryDirectory() as out_dir: |
nothing calls this directly
no test coverage detected