def test_component_functions(self, gradio_temp_dir):
        """
        Preprocess, postprocess, serialize, get_config, _segment_by_slic
        type: pil, file, filepath, numpy
        """

        img = ImageData(path="test/test_files/bus.png", orig_name="bus.png")
        image_input = gr.Image()

        image_input = gr.Image(type="filepath")
        image_temp_filepath = image_input.preprocess(img)
        assert image_temp_filepath in [
            str(f) for f in gradio_temp_dir.glob("**/*") if f.is_file()
        ]

        image_input = gr.Image(type="pil", label="Upload Your Image")
        assert image_input.get_config() == {
            "image_mode": "RGB",
            "sources": ["upload", "webcam", "clipboard"],
            "name": "image",
            "show_share_button": False,
            "show_download_button": True,
            "show_fullscreen_button": True,
            "streaming": False,
            "show_label": True,
            "label": "Upload Your Image",
            "container": True,
            "min_width": 160,
            "scale": None,
            "height": None,
            "width": None,
            "elem_id": None,
            "elem_classes": [],
            "visible": True,
            "value": None,
            "interactive": None,
            "format": "webp",
            "proxy_url": None,
            "webcam_options": {"constraints": None, "mirror": True},
            "_selectable": False,
            "key": None,
            "preserved_by_key": ["value"],
            "streamable": False,
            "type": "pil",
            "placeholder": None,
        }
        assert image_input.preprocess(None) is None
        image_input = gr.Image()
        assert image_input.preprocess(img) is not None
        image_input.preprocess(img)
        file_image = gr.Image(type="filepath", image_mode=None)
        assert Path(img.path).name == Path(str(file_image.preprocess(img))).name  # type: ignore
        with pytest.raises(ValueError):
            gr.Image(type="unknown")  # type: ignore

        with pytest.raises(Error):
            gr.Image().preprocess(
                ImageData(path="test/test_files/test.svg", orig_name="test.svg")
            )

        string_source = gr.Image(sources="upload")
        assert string_source.sources == ["upload"]
        # Output functionalities
        image_output = gr.Image(type="pil")
        processed_image = image_output.postprocess(
            PIL.Image.open(img.path)  # type: ignore
        ).model_dump()  # type: ignore
        assert processed_image is not None
        if processed_image is not None:
            processed = PIL.Image.open(cast(dict, processed_image).get("path", ""))  # type: ignore
            source = PIL.Image.open(img.path)  # type: ignore
            assert processed.size == source.size

        Preprocess, postprocess, serialize, get_config, _segment_by_slic
        type: pil, file, filepath, numpy
        
test/components/test_image.py