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

Function test_decimal_to_int_safe

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

Source from the content-addressed store, hash-verified

1882
1883
1884def test_decimal_to_int_safe():
1885 safe_cases = [
1886 (
1887 [decimal.Decimal("123456"), None, decimal.Decimal("-912345")],
1888 pa.decimal128(32, 5),
1889 [123456, None, -912345],
1890 pa.int32()
1891 ),
1892 (
1893 [decimal.Decimal("1234"), None, decimal.Decimal("-9123")],
1894 pa.decimal128(19, 10),
1895 [1234, None, -9123],
1896 pa.int16()
1897 ),
1898 (
1899 [decimal.Decimal("123"), None, decimal.Decimal("-91")],
1900 pa.decimal128(19, 10),
1901 [123, None, -91],
1902 pa.int8()
1903 ),
1904 ]
1905 for case in safe_cases:
1906 _check_cast_case(case)
1907 _check_cast_case(case, safe=True)
1908
1909
1910@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

_check_cast_caseFunction · 0.85
DecimalMethod · 0.45

Tested by

no test coverage detected