()
| 1335 | |
| 1336 | |
| 1337 | def test_cast_array_xd_to_features_sequence(): |
| 1338 | arr = np.random.randint(0, 10, size=(8, 2, 3)).tolist() |
| 1339 | arr = Array2DExtensionType(shape=(2, 3), dtype="int64").wrap_array(pa.array(arr, pa.list_(pa.list_(pa.int64())))) |
| 1340 | arr = pa.ListArray.from_arrays([0, None, 4, 8], arr) |
| 1341 | # Variable size list |
| 1342 | casted_array = cast_array_to_feature(arr, List(Array2D(shape=(2, 3), dtype="int32"))) |
| 1343 | assert casted_array.type == get_nested_type(List(Array2D(shape=(2, 3), dtype="int32"))) |
| 1344 | assert casted_array.to_pylist() == arr.to_pylist() |
| 1345 | # Fixed size list |
| 1346 | casted_array = cast_array_to_feature(arr, List(Array2D(shape=(2, 3), dtype="int32"), length=4)) |
| 1347 | assert casted_array.type == get_nested_type(List(Array2D(shape=(2, 3), dtype="int32"), length=4)) |
| 1348 | assert casted_array.to_pylist() == arr.to_pylist() |
| 1349 | |
| 1350 | |
| 1351 | def test_embed_array_storage(image_file): |
nothing calls this directly
no test coverage detected