diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 0e25f245efd..5483dcf653c 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -1865,7 +1865,7 @@ def _make_operands_and_index_for_binop( ) if len(other) != self._num_columns: raise ValueError( - "Other is the wrong length. Expected " + "Other is of the wrong length. Expected " f"{self._num_columns}, got {len(other)}" ) diff --git a/python/cudf/cudf/tests/test_dataframe.py b/python/cudf/cudf/tests/test_dataframe.py index bddc1316aec..a7fad792bd0 100644 --- a/python/cudf/cudf/tests/test_dataframe.py +++ b/python/cudf/cudf/tests/test_dataframe.py @@ -2106,6 +2106,11 @@ def test_binops_df(pdf, gdf, binop, other): pass +def test_binops_df_invalid(gdf): + with pytest.raises(TypeError): + gdf + np.array([1, 2]) + + @pytest.mark.parametrize("binop", [operator.and_, operator.or_, operator.xor]) def test_bitwise_binops_df(pdf, gdf, binop): d = binop(pdf, pdf + 1)