def test_to_python(): a = Series("a", range(20)) b = a.to_list() assert isinstance(b, list) assert len(b) == 20 a = Series("a", [1, None, 2], nullable=True) assert a.null_count() == 1 assert a.to_list() == [1, None, 2]
def test_series_slice( srs: pl.Series, start: int | None, stop: int | None, step: int | None, ) -> None: py_data = srs.to_list() s = slice(start, stop, step) sliced_py_data = py_data[s] sliced_pl_data = srs[s].to_list() assert sliced_py_data == sliced_pl_data, f"slice [{start}:{stop}:{step}] failed" assert_series_equal(srs, srs, check_exact=True)
def test_object(): vals = [[12], "foo", 9] a = Series("a", vals) assert a.dtype == Object assert a.to_list() == vals assert a[1] == "foo"