diff --git a/seaborn/distributions.py b/seaborn/distributions.py index 4953f01d59..e3d57c9a42 100644 --- a/seaborn/distributions.py +++ b/seaborn/distributions.py @@ -1593,7 +1593,7 @@ def kdeplot( # Handle (past) deprecation of `data2` if "data2" in kwargs: msg = "`data2` has been removed (replaced by `y`); please update your code." - TypeError(msg) + raise TypeError(msg) # Handle deprecation of `vertical` vertical = kwargs.pop("vertical", None) diff --git a/seaborn/regression.py b/seaborn/regression.py index 5a16fc96ac..5e5503a422 100644 --- a/seaborn/regression.py +++ b/seaborn/regression.py @@ -574,7 +574,7 @@ def lineplot(self, ax, kws): def lmplot( - data=None, *, + data, *, x=None, y=None, hue=None, col=None, row=None, palette=None, col_wrap=None, height=5, aspect=1, markers="o", sharex=None, sharey=None, hue_order=None, col_order=None, row_order=None, diff --git a/tests/test_distributions.py b/tests/test_distributions.py index e5f5c4aad8..0df1a15beb 100644 --- a/tests/test_distributions.py +++ b/tests/test_distributions.py @@ -920,6 +920,10 @@ def test_legend(self, long_df): assert ax.legend_ is None + def test_replaced_kws(self, long_df): + with pytest.raises(TypeError, match=r"`data2` has been removed"): + kdeplot(data=long_df, x="x", data2="y") + class TestKDEPlotBivariate: