()
| 394 | |
| 395 | |
| 396 | def test_cast_int_to_float(): |
| 397 | # GH-34901 |
| 398 | int_scalar = pa.scalar(18014398509481983, type=pa.int64()) |
| 399 | unsafe_cast = int_scalar.cast(pa.float64(), safe=False) |
| 400 | expected_unsafe_cast = pa.scalar(18014398509481983.0, type=pa.float64()) |
| 401 | assert unsafe_cast == expected_unsafe_cast |
| 402 | with pytest.raises(pa.ArrowInvalid): |
| 403 | int_scalar.cast(pa.float64()) # verify default is safe cast |
| 404 | |
| 405 | |
| 406 | @pytest.mark.parametrize("typ", [pa.date32(), pa.date64()]) |