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

Function test_embed_array_storage_nested

tests/test_table.py:1359–1367  ·  view source on GitHub ↗
(image_file)

Source from the content-addressed store, hash-verified

1357
1358
1359def test_embed_array_storage_nested(image_file):
1360 array = pa.array([[{"bytes": None, "path": image_file}]], type=pa.list_(Image.pa_type))
1361 embedded_images_array = embed_array_storage(array, List(Image()))
1362 assert isinstance(embedded_images_array.to_pylist()[0][0]["path"], str)
1363 assert isinstance(embedded_images_array.to_pylist()[0][0]["bytes"], bytes)
1364 array = pa.array([{"foo": {"bytes": None, "path": image_file}}], type=pa.struct({"foo": Image.pa_type}))
1365 embedded_images_array = embed_array_storage(array, {"foo": Image()})
1366 assert isinstance(embedded_images_array.to_pylist()[0]["foo"]["path"], str)
1367 assert isinstance(embedded_images_array.to_pylist()[0]["foo"]["bytes"], bytes)
1368
1369
1370@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

embed_array_storageFunction · 0.90
ListClass · 0.90
ImageClass · 0.90
to_pylistMethod · 0.45

Tested by

no test coverage detected