| 85 | |
| 86 | @pytest.mark.parametrize('dtype_str,arrow_type', tensor_type_pairs) |
| 87 | def test_tensor_numpy_roundtrip(dtype_str, arrow_type): |
| 88 | dtype = np.dtype(dtype_str) |
| 89 | # Casting np.float64 -> uint32 or uint64 throws a RuntimeWarning |
| 90 | with warnings.catch_warnings(): |
| 91 | warnings.simplefilter("ignore") |
| 92 | data = (100 * np.random.randn(10, 4)).astype(dtype) |
| 93 | tensor = pa.Tensor.from_numpy(data) |
| 94 | assert tensor.type == arrow_type |
| 95 | |
| 96 | repr(tensor) |
| 97 | |
| 98 | result = tensor.to_numpy() |
| 99 | assert (data == result).all() |
| 100 | |
| 101 | |
| 102 | def test_tensor_ipc_roundtrip(tmpdir): |