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:1769–1792  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1767
1768
1769def test_decimal_to_int_safe():
1770 safe_cases = [
1771 (
1772 [decimal.Decimal("123456"), None, decimal.Decimal("-912345")],
1773 pa.decimal128(32, 5),
1774 [123456, None, -912345],
1775 pa.int32()
1776 ),
1777 (
1778 [decimal.Decimal("1234"), None, decimal.Decimal("-9123")],
1779 pa.decimal128(19, 10),
1780 [1234, None, -9123],
1781 pa.int16()
1782 ),
1783 (
1784 [decimal.Decimal("123"), None, decimal.Decimal("-91")],
1785 pa.decimal128(19, 10),
1786 [123, None, -91],
1787 pa.int8()
1788 ),
1789 ]
1790 for case in safe_cases:
1791 _check_cast_case(case)
1792 _check_cast_case(case, safe=True)
1793
1794
1795@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

_check_cast_caseFunction · 0.85
DecimalMethod · 0.45

Tested by

no test coverage detected