Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/py-polars/tests/unit/test_ds_plugin.py
6939 views
1
import pytest
2
3
import polars as pl
4
from polars.dependencies import _lazy_import
5
from polars.testing import assert_frame_equal
6
7
# don't import polars_ds until an actual test is triggered (the decorator already
8
# ensures the tests aren't run locally; this avoids premature local import)
9
pds, _ = _lazy_import("polars_ds")
10
11
pytestmark = pytest.mark.ci_only
12
13
14
def test_basic_operation() -> None:
15
# We are mostly interested in making sure that we can actually still call the plugin
16
# properly.
17
df = pl.DataFrame({"name": ["a", "b", "c"]})
18
assert_frame_equal(
19
df.select(pds.str_leven("name", pl.lit("che"))),
20
pl.Series("name", [3, 3, 2], pl.UInt32).to_frame(),
21
)
22
23