()
| 1735 | |
| 1736 | @pytest.mark.numpy |
| 1737 | def test_floating_point_truncate_unsafe(): |
| 1738 | unsafe_cases = [ |
| 1739 | (np.array([1.1, 2.2, 3.3], dtype='float32'), 'float32', |
| 1740 | np.array([1, 2, 3], dtype='i4'), pa.int32()), |
| 1741 | (np.array([1.1, 2.2, 3.3], dtype='float64'), 'float64', |
| 1742 | np.array([1, 2, 3], dtype='i4'), pa.int32()), |
| 1743 | (np.array([-10.1, 20.2, -30.3], dtype='float64'), 'float64', |
| 1744 | np.array([-10, 20, -30], dtype='i4'), pa.int32()), |
| 1745 | ] |
| 1746 | for case in unsafe_cases: |
| 1747 | # test safe casting raises |
| 1748 | with pytest.raises(pa.ArrowInvalid, match='truncated'): |
| 1749 | _check_cast_case(case, safe=True) |
| 1750 | |
| 1751 | # test unsafe casting truncates |
| 1752 | _check_cast_case(case, safe=False) |
| 1753 | |
| 1754 | |
| 1755 | def test_half_float_array_from_python(): |
nothing calls this directly
no test coverage detected