()
| 3190 | |
| 3191 | |
| 3192 | def test_min_max_element_wise(): |
| 3193 | arr1 = pa.array([1, 2, 3]) |
| 3194 | arr2 = pa.array([3, 1, 2]) |
| 3195 | arr3 = pa.array([2, 3, None]) |
| 3196 | |
| 3197 | result = pc.max_element_wise(arr1, arr2) |
| 3198 | assert result == pa.array([3, 2, 3]) |
| 3199 | result = pc.min_element_wise(arr1, arr2) |
| 3200 | assert result == pa.array([1, 1, 2]) |
| 3201 | |
| 3202 | result = pc.max_element_wise(arr1, arr2, arr3) |
| 3203 | assert result == pa.array([3, 3, 3]) |
| 3204 | result = pc.min_element_wise(arr1, arr2, arr3) |
| 3205 | assert result == pa.array([1, 1, 2]) |
| 3206 | |
| 3207 | # with specifying the option |
| 3208 | result = pc.max_element_wise(arr1, arr3, skip_nulls=True) |
| 3209 | assert result == pa.array([2, 3, 3]) |
| 3210 | result = pc.min_element_wise(arr1, arr3, skip_nulls=True) |
| 3211 | assert result == pa.array([1, 2, 3]) |
| 3212 | result = pc.max_element_wise( |
| 3213 | arr1, arr3, options=pc.ElementWiseAggregateOptions()) |
| 3214 | assert result == pa.array([2, 3, 3]) |
| 3215 | result = pc.min_element_wise( |
| 3216 | arr1, arr3, options=pc.ElementWiseAggregateOptions()) |
| 3217 | assert result == pa.array([1, 2, 3]) |
| 3218 | |
| 3219 | # not skipping nulls |
| 3220 | result = pc.max_element_wise(arr1, arr3, skip_nulls=False) |
| 3221 | assert result == pa.array([2, 3, None]) |
| 3222 | result = pc.min_element_wise(arr1, arr3, skip_nulls=False) |
| 3223 | assert result == pa.array([1, 2, None]) |
| 3224 | |
| 3225 | |
| 3226 | @pytest.mark.numpy |
nothing calls this directly
no test coverage detected