()
| 1850 | |
| 1851 | @pytest.mark.numpy |
| 1852 | def test_floating_point_truncate_unsafe(): |
| 1853 | unsafe_cases = [ |
| 1854 | (np.array([1.1, 2.2, 3.3], dtype='float32'), 'float32', |
| 1855 | np.array([1, 2, 3], dtype='i4'), pa.int32()), |
| 1856 | (np.array([1.1, 2.2, 3.3], dtype='float64'), 'float64', |
| 1857 | np.array([1, 2, 3], dtype='i4'), pa.int32()), |
| 1858 | (np.array([-10.1, 20.2, -30.3], dtype='float64'), 'float64', |
| 1859 | np.array([-10, 20, -30], dtype='i4'), pa.int32()), |
| 1860 | ] |
| 1861 | for case in unsafe_cases: |
| 1862 | # test safe casting raises |
| 1863 | with pytest.raises(pa.ArrowInvalid, match='truncated'): |
| 1864 | _check_cast_case(case, safe=True) |
| 1865 | |
| 1866 | # test unsafe casting truncates |
| 1867 | _check_cast_case(case, safe=False) |
| 1868 | |
| 1869 | |
| 1870 | def test_half_float_array_from_python(): |
nothing calls this directly
no test coverage detected