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

Function test_fill_null

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

Source from the content-addressed store, hash-verified

2101
2102
2103def test_fill_null():
2104 arr = pa.array([1, 2, None, 4], type=pa.int8())
2105 fill_value = pa.array([5], type=pa.int8())
2106 with pytest.raises(pa.ArrowInvalid,
2107 match="Array arguments must all be the same length"):
2108 arr.fill_null(fill_value)
2109
2110 arr = pa.array([None, None, None, None], type=pa.null())
2111 fill_value = pa.scalar(None, type=pa.null())
2112 result = arr.fill_null(fill_value)
2113 expected = pa.array([None, None, None, None])
2114 assert result.equals(expected)
2115
2116 arr = pa.array(['a', 'bb', None])
2117 result = arr.fill_null('ccc')
2118 expected = pa.array(['a', 'bb', 'ccc'])
2119 assert result.equals(expected)
2120
2121 arr = pa.array([b'a', b'bb', None], type=pa.large_binary())
2122 result = arr.fill_null('ccc')
2123 expected = pa.array([b'a', b'bb', b'ccc'], type=pa.large_binary())
2124 assert result.equals(expected)
2125
2126 arr = pa.array(['a', 'bb', None])
2127 result = arr.fill_null(None)
2128 expected = pa.array(['a', 'bb', None])
2129 assert result.equals(expected)
2130
2131
2132@pytest.mark.parametrize('arrow_type', numerical_arrow_types)

Callers

nothing calls this directly

Calls 3

equalsMethod · 0.80
arrayMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected