| 3883 | |
| 3884 | @pytest.mark.numpy |
| 3885 | def test_array_invalid_mask_raises(): |
| 3886 | # ARROW-10742 |
| 3887 | cases = [ |
| 3888 | ([1, 2], np.array([False, False], dtype="O"), |
| 3889 | TypeError, "must be boolean dtype"), |
| 3890 | |
| 3891 | ([1, 2], np.array([[False], [False]]), |
| 3892 | pa.ArrowInvalid, "must be 1D array"), |
| 3893 | |
| 3894 | ([1, 2, 3], np.array([False, False]), |
| 3895 | pa.ArrowInvalid, "different length"), |
| 3896 | |
| 3897 | (np.array([1, 2]), np.array([False, False], dtype="O"), |
| 3898 | TypeError, "must be boolean dtype"), |
| 3899 | |
| 3900 | (np.array([1, 2]), np.array([[False], [False]]), |
| 3901 | ValueError, "must be 1D array"), |
| 3902 | |
| 3903 | (np.array([1, 2, 3]), np.array([False, False]), |
| 3904 | ValueError, "different length"), |
| 3905 | ] |
| 3906 | for obj, mask, ex, msg in cases: |
| 3907 | with pytest.raises(ex, match=msg): |
| 3908 | pa.array(obj, mask=mask) |
| 3909 | |
| 3910 | |
| 3911 | def test_array_from_large_pyints(): |