def test_non_pd_type_error(self):
        """Test an error is raised if y is not passed as a pd.DataFrame."""

        x = BaseTransformer(columns="a")

        with pytest.raises(ValueError):

            x.transform(X=[1, 2, 3, 4, 5, 6])
    def test_no_rows_error(self):
        """Test an error is raised if X has no rows."""

        x = BaseTransformer(columns="a")

        df = pandas.DataFrame(columns=["a"])

        with pytest.raises(ValueError, match=re.escape("X has no rows; (0, 1)")):

            x.transform(df)
    def test_df_copy_called(self, mocker):
        """Test pd.DataFrame.copy is called if copy is True."""

        df = d.create_df_1()

        x = BaseTransformer(columns="a", copy=True)

        expected_call_args = {0: {"args": (), "kwargs": {}}}

        with h.assert_function_call(
            mocker, pandas.DataFrame, "copy", expected_call_args, return_value=df
        ):

            x.transform(X=df)
    def test_columns_check_called(self, mocker):
        """Test that self.columns_check is called during transform."""

        df = d.create_df_1()

        x = BaseTransformer(columns="a")

        expected_call_args = {0: {"args": (df,), "kwargs": {}}}

        with h.assert_function_call(
            mocker, tubular.base.BaseTransformer, "columns_check", expected_call_args
        ):

            x.transform(X=df)
    def test_X_returned(self, df, expected):
        """Test that X is returned from transform."""

        x = BaseTransformer(columns="a", copy=True)

        df_transformed = x.transform(X=df)

        h.assert_equal_dispatch(
            expected=expected,
            actual=df_transformed,
            msg="Check X returned from transform",
        )