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

Function test_array_accepts_pyarrow_array

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

Source from the content-addressed store, hash-verified

4170
4171
4172def test_array_accepts_pyarrow_array():
4173 arr = pa.array([1, 2, 3])
4174 result = pa.array(arr)
4175 assert arr == result
4176
4177 # Test casting to a different type
4178 result = pa.array(arr, type=pa.uint8())
4179 expected = pa.array([1, 2, 3], type=pa.uint8())
4180 assert expected == result
4181 assert expected.type == pa.uint8()
4182
4183 # Test casting with safe keyword
4184 arr = pa.array([2 ** 63 - 1], type=pa.int64())
4185
4186 with pytest.raises(pa.ArrowInvalid):
4187 pa.array(arr, type=pa.int32())
4188
4189 expected = pa.array([-1], type=pa.int32())
4190 result = pa.array(arr, type=pa.int32(), safe=False)
4191 assert result == expected
4192
4193 # Test memory_pool keyword is accepted
4194 result = pa.array(arr, memory_pool=pa.default_memory_pool())
4195 assert arr == result
4196
4197
4198def check_run_end_encoded(ree_array, run_ends, values, logical_length, physical_length,

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected