| 2038 | |
| 2039 | |
| 2040 | def 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 | |
| 2057 | def test_is_null(): |