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

Function test_cast_integers_unsafe

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

Source from the content-addressed store, hash-verified

1700
1701@pytest.mark.numpy
1702def test_cast_integers_unsafe():
1703 # We let NumPy do the unsafe casting.
1704 # Note that NEP50 in the NumPy spec no longer allows
1705 # the np.array() constructor to pass the dtype directly
1706 # if it results in an unsafe cast.
1707 unsafe_cases = [
1708 (np.array([50000], dtype='i4'), 'int32',
1709 np.array([50000]).astype(dtype='i2'), pa.int16()),
1710 (np.array([70000], dtype='i4'), 'int32',
1711 np.array([70000]).astype(dtype='u2'), pa.uint16()),
1712 (np.array([-1], dtype='i4'), 'int32',
1713 np.array([-1]).astype(dtype='u2'), pa.uint16()),
1714 (np.array([50000], dtype='u2'), pa.uint16(),
1715 np.array([50000]).astype(dtype='i2'), pa.int16())
1716 ]
1717
1718 for case in unsafe_cases:
1719 _check_cast_case(case, safe=False)
1720
1721
1722@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

_check_cast_caseFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected