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

Function test_binary_join_element_wise

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

Source from the content-addressed store, hash-verified

1432
1433
1434def test_binary_join_element_wise():
1435 null = pa.scalar(None, type=pa.string())
1436 arrs = [[None, 'a', 'b'], ['c', None, 'd'], [None, '-', '--']]
1437 assert pc.binary_join_element_wise(*arrs).to_pylist() == \
1438 [None, None, 'b--d']
1439 assert pc.binary_join_element_wise('a', 'b', '-').as_py() == 'a-b'
1440 assert pc.binary_join_element_wise('a', null, '-').as_py() is None
1441 assert pc.binary_join_element_wise('a', 'b', null).as_py() is None
1442
1443 skip = pc.JoinOptions(null_handling='skip')
1444 assert pc.binary_join_element_wise(*arrs, options=skip).to_pylist() == \
1445 [None, 'a', 'b--d']
1446 assert pc.binary_join_element_wise(
1447 'a', 'b', '-', options=skip).as_py() == 'a-b'
1448 assert pc.binary_join_element_wise(
1449 'a', null, '-', options=skip).as_py() == 'a'
1450 assert pc.binary_join_element_wise(
1451 'a', 'b', null, options=skip).as_py() is None
1452
1453 replace = pc.JoinOptions(null_handling='replace', null_replacement='spam')
1454 assert pc.binary_join_element_wise(*arrs, options=replace).to_pylist() == \
1455 [None, 'a-spam', 'b--d']
1456 assert pc.binary_join_element_wise(
1457 'a', 'b', '-', options=replace).as_py() == 'a-b'
1458 assert pc.binary_join_element_wise(
1459 'a', null, '-', options=replace).as_py() == 'a-spam'
1460 assert pc.binary_join_element_wise(
1461 'a', 'b', null, options=replace).as_py() is None
1462
1463
1464@pytest.mark.parametrize(('ty', 'values'), all_array_types)

Callers

nothing calls this directly

Calls 4

as_pyMethod · 0.80
JoinOptionsMethod · 0.80
scalarMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected