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

Function test_sum_array

python/pyarrow/tests/test_compute.py:347–365  ·  view source on GitHub ↗
(arrow_type)

Source from the content-addressed store, hash-verified

345
346@pytest.mark.parametrize('arrow_type', numerical_arrow_types)
347def test_sum_array(arrow_type):
348 arr = pa.array([1, 2, 3, 4], type=arrow_type)
349 assert arr.sum().as_py() == 10
350 assert pc.sum(arr).as_py() == 10
351
352 arr = pa.array([1, 2, 3, 4, None], type=arrow_type)
353 assert arr.sum().as_py() == 10
354 assert pc.sum(arr).as_py() == 10
355
356 arr = pa.array([None], type=arrow_type)
357 assert arr.sum().as_py() is None # noqa: E711
358 assert pc.sum(arr).as_py() is None # noqa: E711
359 assert arr.sum(min_count=0).as_py() == 0
360 assert pc.sum(arr, min_count=0).as_py() == 0
361
362 arr = pa.array([], type=arrow_type)
363 assert arr.sum().as_py() is None # noqa: E711
364 assert arr.sum(min_count=0).as_py() == 0
365 assert pc.sum(arr, min_count=0).as_py() == 0
366
367
368@pytest.mark.parametrize("arrow_type", [pa.decimal128(3, 2), pa.decimal256(3, 2)])

Callers

nothing calls this directly

Calls 3

as_pyMethod · 0.80
arrayMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected