MCPcopy Create free account
hub / github.com/apache/arrow / test_cast_integers_unsafe

Function test_cast_integers_unsafe

python/pyarrow/tests/test_array.py:1817–1834  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1815
1816@pytest.mark.numpy
1817def 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

Callers

nothing calls this directly

Calls 2

_check_cast_caseFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected