MCPcopy Create free account
hub / github.com/apache/arrow / test_recordbatch_to_tensor_empty

Function test_recordbatch_to_tensor_empty

python/pyarrow/tests/test_table.py:1239–1254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1237
1238@pytest.mark.numpy
1239def test_recordbatch_to_tensor_empty():
1240 batch = pa.RecordBatch.from_arrays(
1241 [
1242 pa.array([], type=pa.float32()),
1243 pa.array([], type=pa.float32()),
1244 ], ["a", "b"]
1245 )
1246 result = batch.to_tensor()
1247
1248 x = np.column_stack([[], []]).astype(np.float32, order="F")
1249 expected = pa.Tensor.from_numpy(x)
1250
1251 assert result.size == expected.size
1252 assert result.type == pa.float32()
1253 assert result.shape == expected.shape
1254 assert result.strides == (4, 4)
1255
1256
1257def test_recordbatch_to_tensor_unsupported():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected