MCPcopy Index your code
hub / github.com/huggingface/datasets / test_array_xd_numpy_arrow_extractor

Function test_array_xd_numpy_arrow_extractor

tests/features/test_array_xd.py:371–376  ·  view source on GitHub ↗
(dtype, dummy_value)

Source from the content-addressed store, hash-verified

369
370@pytest.mark.parametrize("dtype, dummy_value", [("int32", 1), ("bool", True), ("float64", 1)])
371def test_array_xd_numpy_arrow_extractor(dtype, dummy_value):
372 features = datasets.Features({"foo": datasets.Array2D(dtype=dtype, shape=(2, 2))})
373 dataset = datasets.Dataset.from_dict({"foo": [[[dummy_value] * 2] * 2]}, features=features)
374 arr = NumpyArrowExtractor().extract_column(dataset._data)
375 assert isinstance(arr, np.ndarray)
376 np.testing.assert_equal(arr, np.array([[[dummy_value] * 2] * 2], dtype=np.dtype(dtype)))
377
378
379def test_array_xd_with_none():

Callers

nothing calls this directly

Calls 4

NumpyArrowExtractorClass · 0.90
dtypeMethod · 0.80
from_dictMethod · 0.45
extract_columnMethod · 0.45

Tested by

no test coverage detected