diff --git a/narwhals/functions.py b/narwhals/functions.py index b380aec7b..4e31d5b41 100644 --- a/narwhals/functions.py +++ b/narwhals/functions.py @@ -62,7 +62,7 @@ def concat( A new DataFrame, Lazyframe resulting from the concatenation. Raises: - NotImplementedError: The items to concatenate should either all be eager, or all lazy + TypeError: The items to concatenate should either all be eager, or all lazy Examples: Let's take an example of vertical concatenation: diff --git a/narwhals/stable/v1/__init__.py b/narwhals/stable/v1/__init__.py index 80b3cc753..52d75678f 100644 --- a/narwhals/stable/v1/__init__.py +++ b/narwhals/stable/v1/__init__.py @@ -2758,7 +2758,7 @@ def concat( A new DataFrame, Lazyframe resulting from the concatenation. Raises: - NotImplementedError: The items to concatenate should either all be eager, or all lazy + TypeError: The items to concatenate should either all be eager, or all lazy Examples: Let's take an example of vertical concatenation: diff --git a/narwhals/utils.py b/narwhals/utils.py index a639f4162..817c2bc9a 100644 --- a/narwhals/utils.py +++ b/narwhals/utils.py @@ -194,8 +194,8 @@ def validate_laziness(items: Iterable[Any]) -> None: all(isinstance(item, LazyFrame) for item in items) ): return - msg = "The items to concatenate should either all be eager, or all lazy" - raise NotImplementedError(msg) + msg = f"The items to concatenate should either all be eager, or all lazy, got: {[type(item) for item in items]}" + raise TypeError(msg) def maybe_align_index( diff --git a/tests/frame/invalid_test.py b/tests/frame/invalid_test.py index 9abf4bd2c..257dade28 100644 --- a/tests/frame/invalid_test.py +++ b/tests/frame/invalid_test.py @@ -37,7 +37,7 @@ def test_native_vs_non_native() -> None: def test_validate_laziness() -> None: df = pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) with pytest.raises( - NotImplementedError, + TypeError, match=("The items to concatenate should either all be eager, or all lazy"), ): nw.concat([nw.from_native(df, eager_only=True), nw.from_native(df).lazy()]) # type: ignore[list-item]