()
| 384 | |
| 385 | |
| 386 | def test_cast_float_to_int(): |
| 387 | # GH-35040 |
| 388 | float_scalar = pa.scalar(1.5, type=pa.float64()) |
| 389 | unsafe_cast = float_scalar.cast(pa.int64(), safe=False) |
| 390 | expected_unsafe_cast = pa.scalar(1, type=pa.int64()) |
| 391 | assert unsafe_cast == expected_unsafe_cast |
| 392 | with pytest.raises(pa.ArrowInvalid): |
| 393 | float_scalar.cast(pa.int64()) # verify default is safe cast |
| 394 | |
| 395 | |
| 396 | def test_cast_int_to_float(): |