def METHOD_NAME(self):
    with tempfile.TemporaryDirectory() as out_dir:
        image_name = os.path.join(out_dir, "test.png")
        img = np.random.rand(2, 3, 1)
        img_save_val = (255 * img).astype(np.uint8).squeeze(2)
        writer_obj = PILWriter(output_dtype=np.uint8, scale=255)
        writer_obj.set_data_array(img, channel_dim=None)
        writer_obj.write(image_name, format="PNG")
        out = np.asarray(Image.open(image_name))
        out = np.moveaxis(out, 0, 1)
        np.testing.assert_allclose(out, img_save_val)