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

Function test_round_binary

python/pyarrow/tests/test_compute.py:2040–2054  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2038
2039
2040def test_round_binary():
2041 values = [123.456, 234.567, 345.678, 456.789, 123.456, 234.567, 345.678]
2042 scales = pa.array([-3, -2, -1, 0, 1, 2, 3], pa.int32())
2043 expected = pa.array(
2044 [0, 200, 350, 457, 123.5, 234.57, 345.678], pa.float64())
2045 assert pc.round_binary(values, scales) == expected
2046
2047 expect_zero = pa.scalar(0, pa.float64())
2048 expect_inf = pa.scalar(10, pa.float64())
2049 scale = pa.scalar(-1, pa.int32())
2050
2051 assert pc.round_binary(
2052 5.0, scale, round_mode="half_towards_zero") == expect_zero
2053 assert pc.round_binary(
2054 5.0, scale, round_mode="half_towards_infinity") == expect_inf
2055
2056
2057def test_is_null():

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected