TST: Add tests for num-bool coercion
State: closed

Boolean dtypes in both Series and DataFrames should be coerced
to the other operand's dtype.

- [x] closes #18549
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
@jbrockmendel was this perhaps fixed by some of the `_maybe_promote` work you've been doing?
> was this perhaps fixed by some of the _maybe_promote work you've been doing?

Doubtful.  I don't think maybe_promote is used anywhere in/around ops.

@Kazz47 would the same test be applicable for Index classes?  Can you parametrize the test over [Index, Series, DataFrame] and put it somewhere in tests.arithmetic?
@jbrockmendel some of the operators (multiply and floordiv) aren't supported by Index. Should these be skipped if we see a TypeError for some operators? If so I can update the PR. Otherwise, do you have a more graceful way of handling this?

```python
    @pytest.mark.parametrize("container_cls_assert", [(pd.Index, tm.assert_index_equal),
                                                      (pd.Series, tm.assert_series_equal),
                                                      (pd.DataFrame, tm.assert_frame_equal)])
    @pytest.mark.parametrize("num", [1.0, 1])
    @pytest.mark.parametrize(
        "op", [operator.add, operator.mul, operator.floordiv, operator.sub]
    )
    def test_array_like_bool_and_num_op_coerce(self, container_cls_assert, num, op):
        # GH 18549
        container_cls = container_cls_assert[0]
        container_assert = container_cls_assert[1]
        expected = container_cls([op(num, num)])
        bool_array = container_cls([True])
        container_assert(expected, op(bool_array, num))
        container_assert(expected, op(num, bool_array))

```
> some of the operators (multiply and floordiv) aren't supported by Index

If the array you're passing to Index is all numeric, you should get Int64Index or Float64Index, so you'll be OK.  

You can use tm.assert_equal instead of container_cls_assert.

In tests.arithmetic we use a `box` or `box_with_array` fixture along with calls to `tm.box_expected(obj, box)` to parametrize tests across classes.  If you can adhere to that pattern that'd be ideal
> If the array you're passing to Index is all numeric, you should get Int64Index or Float64Index, so you'll be OK.

Since we are passing a bool we don't get Int64Index or Float64Index and the numeric operators are being disabled.

https://github.com/pandas-dev/pandas/blob/2931f0222c6bffe3d7479f1823bbd5c508dbca6a/pandas/core/indexes/base.py#L5505

#### Latest version:
```python
class TestNumericArraylikeArithmeticWithBool:
    @pytest.mark.parametrize("num", [1.0, 1])
    @pytest.mark.parametrize(
        "op", [operator.add, operator.mul, operator.floordiv, operator.sub]
    )
    def test_array_like_bool_and_num_op_coerce(self, num, op, box_with_array):
        # GH 18549
        expected = [op(num, num)]
        expected = tm.box_expected(expected, box_with_array)
        bool_box = tm.box_expected([True], box_with_array)
        tm.assert_equal(expected, op(bool_box, num))
        tm.assert_equal(expected, op(num, bool_box))
```
@Kazz47 is this still active? Can you merge master and address comment?
Nice PR but needs rebase and I think has gone stale. Ping if you'd like to pick this back up