Skip to content

Commit f1cf356

Browse files
committed
fix nw.LazyFrame missing _version ClassVar
1 parent 666ec37 commit f1cf356

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

narwhals/dataframe.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,8 @@ class LazyFrame(BaseFrame[LazyFrameT]):
23612361
```
23622362
"""
23632363

2364+
_version: ClassVar[Version] = Version.MAIN
2365+
23642366
@property
23652367
def _compliant(self) -> CompliantLazyFrame[Any, LazyFrameT, Self]:
23662368
return self._compliant_frame

narwhals/stable/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ def _l1_norm(self) -> Self:
258258

259259

260260
class LazyFrame(NwLazyFrame[IntoLazyFrameT]):
261+
_version = Version.V1
262+
261263
@inherit_doc(NwLazyFrame)
262264
def __init__(self, df: Any, *, level: Literal["full", "lazy", "interchange"]) -> None:
263265
assert df._version is Version.V1 # noqa: S101

narwhals/stable/v2/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ def is_unique(self) -> Series[Any]:
241241

242242

243243
class LazyFrame(NwLazyFrame[IntoLazyFrameT]):
244+
_version = Version.V2
245+
244246
@inherit_doc(NwLazyFrame)
245247
def __init__(self, df: Any, *, level: Literal["full", "lazy", "interchange"]) -> None:
246248
assert df._version is Version.V2 # noqa: S101

tests/v1_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ def test_lazyframe_recursive_v1() -> None:
621621

622622
pl_frame = pl.DataFrame({"a": [1, 2, 3]}).lazy()
623623
nw_frame = nw_v1.from_native(pl_frame)
624-
with pytest.raises(AttributeError):
624+
with pytest.raises(AssertionError):
625625
nw_v1.LazyFrame(nw_frame, level="lazy")
626626

627627
nw_frame_early_return = nw_v1.from_native(nw_frame)

0 commit comments

Comments
 (0)