()
| 1992 | |
| 1993 | @pytest.mark.numpy |
| 1994 | def test_round(): |
| 1995 | values = [320, 3.5, 3.075, 4.5, -3.212, -35.1234, -3.045, None] |
| 1996 | ndigits_and_expected = { |
| 1997 | -2: [300, 0, 0, 0, -0, -0, -0, None], |
| 1998 | -1: [320, 0, 0, 0, -0, -40, -0, None], |
| 1999 | 0: [320, 4, 3, 5, -3, -35, -3, None], |
| 2000 | 1: [320, 3.5, 3.1, 4.5, -3.2, -35.1, -3, None], |
| 2001 | 2: [320, 3.5, 3.08, 4.5, -3.21, -35.12, -3.05, None], |
| 2002 | } |
| 2003 | for ndigits, expected in ndigits_and_expected.items(): |
| 2004 | options = pc.RoundOptions(ndigits, "half_towards_infinity") |
| 2005 | result = pc.round(values, options=options) |
| 2006 | np.testing.assert_allclose(result, pa.array(expected), equal_nan=True) |
| 2007 | assert pc.round(values, ndigits, |
| 2008 | round_mode="half_towards_infinity") == result |
| 2009 | assert pc.round(values, ndigits, "half_towards_infinity") == result |
| 2010 | |
| 2011 | |
| 2012 | @pytest.mark.numpy |
nothing calls this directly
no test coverage detected