()
| 1432 | |
| 1433 | |
| 1434 | def 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) |
nothing calls this directly
no test coverage detected