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

Function test_binary_array_masked

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

Source from the content-addressed store, hash-verified

3836
3837@pytest.mark.numpy
3838def test_binary_array_masked():
3839 # ARROW-12431
3840 masked_basic = pa.array([b'\x05'], type=pa.binary(1),
3841 mask=np.array([False]))
3842 assert [b'\x05'] == masked_basic.to_pylist()
3843
3844 # Fixed Length Binary
3845 masked = pa.array(np.array([b'\x05']), type=pa.binary(1),
3846 mask=np.array([False]))
3847 assert [b'\x05'] == masked.to_pylist()
3848
3849 masked_nulls = pa.array(np.array([b'\x05']), type=pa.binary(1),
3850 mask=np.array([True]))
3851 assert [None] == masked_nulls.to_pylist()
3852
3853 # Variable Length Binary
3854 masked = pa.array(np.array([b'\x05']), type=pa.binary(),
3855 mask=np.array([False]))
3856 assert [b'\x05'] == masked.to_pylist()
3857
3858 masked_nulls = pa.array(np.array([b'\x05']), type=pa.binary(),
3859 mask=np.array([True]))
3860 assert [None] == masked_nulls.to_pylist()
3861
3862 # Fixed Length Binary, copy
3863 npa = np.array([b'aaa', b'bbb', b'ccc']*10)
3864 arrow_array = pa.array(npa, type=pa.binary(3),
3865 mask=np.array([False, False, False]*10))
3866 npa[npa == b"bbb"] = b"XXX"
3867 assert ([b'aaa', b'bbb', b'ccc']*10) == arrow_array.to_pylist()
3868
3869
3870@pytest.mark.numpy

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected