Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Dec 2, 2024
1 parent 0bb3d48 commit 73cf244
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/pickle_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from __future__ import annotations

from dataclasses import asdict
from dataclasses import dataclass
from typing import Sequence

import pandas as pd
import polars as pl

import narwhals.stable.v1 as nw


def test_dataclass() -> None:
# https://github.com/narwhals-dev/narwhals/issues/1486
@dataclass
class Foo:
a: Sequence[int]

# dry-run to check that none of these error
asdict(Foo(pd.Series([1, 2, 3])))
asdict(Foo(pl.Series([1, 2, 3]))) # type: ignore[arg-type]
asdict(Foo(nw.from_native(pl.Series([1, 2, 3]), series_only=True))) # type: ignore[arg-type]
asdict(Foo(nw.from_native(pd.Series([1, 2, 3]), series_only=True))) # type: ignore[arg-type]

0 comments on commit 73cf244

Please sign in to comment.