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

Function test_decimal256

python/pyarrow/tests/test_scalars.py:284–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

282
283
284def test_decimal256():
285 v = decimal.Decimal("1234567890123456789012345678901234567890.123")
286 s = pa.scalar(v)
287 assert isinstance(s, pa.Decimal256Scalar)
288 assert s.as_py() == v
289 assert s.type == pa.decimal256(43, 3)
290
291 v = decimal.Decimal("1.1234")
292 with pytest.raises(pa.ArrowInvalid):
293 pa.scalar(v, type=pa.decimal256(4, scale=3))
294 with pytest.raises(pa.ArrowInvalid):
295 pa.scalar(v, type=pa.decimal256(5, scale=3))
296
297 s = pa.scalar(v, type=pa.decimal256(5, scale=4))
298 assert isinstance(s, pa.Decimal256Scalar)
299 assert s.as_py() == v
300
301
302def test_date():

Callers

nothing calls this directly

Calls 3

as_pyMethod · 0.80
DecimalMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected