()
| 1815 | |
| 1816 | @pytest.mark.numpy |
| 1817 | def test_cast_integers_unsafe(): |
| 1818 | # We let NumPy do the unsafe casting. |
| 1819 | # Note that NEP50 in the NumPy spec no longer allows |
| 1820 | # the np.array() constructor to pass the dtype directly |
| 1821 | # if it results in an unsafe cast. |
| 1822 | unsafe_cases = [ |
| 1823 | (np.array([50000], dtype='i4'), 'int32', |
| 1824 | np.array([50000]).astype(dtype='i2'), pa.int16()), |
| 1825 | (np.array([70000], dtype='i4'), 'int32', |
| 1826 | np.array([70000]).astype(dtype='u2'), pa.uint16()), |
| 1827 | (np.array([-1], dtype='i4'), 'int32', |
| 1828 | np.array([-1]).astype(dtype='u2'), pa.uint16()), |
| 1829 | (np.array([50000], dtype='u2'), pa.uint16(), |
| 1830 | np.array([50000]).astype(dtype='i2'), pa.int16()) |
| 1831 | ] |
| 1832 | |
| 1833 | for case in unsafe_cases: |
| 1834 | _check_cast_case(case, safe=False) |
| 1835 | |
| 1836 | |
| 1837 | @pytest.mark.numpy |
nothing calls this directly
no test coverage detected