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

Function test_cast_int_to_float

python/pyarrow/tests/test_scalars.py:396–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394
395
396def 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()])

Callers

nothing calls this directly

Calls 2

scalarMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected