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

Function test_scatter

python/pyarrow/tests/test_compute.py:1792–1805  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1790
1791
1792def test_scatter():
1793 values = pa.array([True, False, True, True, False, False, True, True, True, False])
1794 indices = pa.array([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
1795 expected = pa.array([False, True, True, True, False,
1796 False, True, True, False, True])
1797 result = pc.scatter(values, indices)
1798 assert result.equals(expected)
1799
1800 options = pc.ScatterOptions(max_index=-1)
1801 assert pc.scatter(values, indices, options=options).equals(expected)
1802 assert pc.scatter(values, indices, max_index=9).equals(expected)
1803
1804 with pytest.raises(ArrowIndexError, match="Index out of bounds: 9"):
1805 pc.scatter(values, indices, max_index=4)
1806
1807
1808@pytest.mark.parametrize("typ", ["array", "chunked_array"])

Callers

nothing calls this directly

Calls 3

equalsMethod · 0.80
ScatterOptionsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected