MCPcopy
hub / github.com/huggingface/datasets / test_image_decode_example

Function test_image_decode_example

tests/features/test_image.py:81–94  ·  view source on GitHub ↗
(shared_datadir)

Source from the content-addressed store, hash-verified

79
80@require_pil
81def test_image_decode_example(shared_datadir):
82 import PIL.Image
83
84 image_path = str(shared_datadir / "test_image_rgb.jpg")
85 image = Image()
86 decoded_example = image.decode_example({"path": image_path, "bytes": None})
87
88 assert isinstance(decoded_example, PIL.Image.Image)
89 assert os.path.samefile(decoded_example.filename, image_path)
90 assert decoded_example.size == (640, 480)
91 assert decoded_example.mode == "RGB"
92
93 with pytest.raises(RuntimeError):
94 Image(decode=False).decode_example(image_path)
95
96
97@require_pil

Callers

nothing calls this directly

Calls 3

decode_exampleMethod · 0.95
ImageClass · 0.90
decode_exampleMethod · 0.45

Tested by

no test coverage detected