Skip to content

Commit

Permalink
Add new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Dec 27, 2023
1 parent 9a8f843 commit f01d8cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions py-polars/tests/unit/datatypes/test_string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import polars as pl
from polars.testing import assert_series_equal


def test_series_init_string() -> None:
s = pl.Series(["a", "b"])
assert s.dtype == pl.String


def test_utf8_alias_eq() -> None:
assert pl.Utf8 == pl.String()
assert pl.Utf8() == pl.String
assert pl.Utf8() == pl.String()


def test_utf8_alias_hash() -> None:
assert hash(pl.Utf8()) == hash(pl.String())


def test_utf8_alias_series_init() -> None:
s = pl.Series(["a", "b"], dtype=pl.Utf8)
assert s.dtype == pl.String


def test_utf8_alias_lit() -> None:
result = pl.select(a=pl.lit(5, dtype=pl.Utf8)).to_series()
expected = pl.Series("a", ["5"], dtype=pl.String)
assert_series_equal(result, expected)
1 change: 1 addition & 0 deletions py-polars/tests/unit/interchange/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
(pl.Float64, (DtypeKind.FLOAT, 64, "g", NE)),
(pl.Boolean, (DtypeKind.BOOL, 1, "b", NE)),
(pl.String, (DtypeKind.STRING, 8, "U", NE)),
(pl.Utf8, (DtypeKind.STRING, 8, "U", NE)),
(pl.Date, (DtypeKind.DATETIME, 32, "tdD", NE)),
(pl.Time, (DtypeKind.DATETIME, 64, "ttu", NE)),
(pl.Categorical, (DtypeKind.CATEGORICAL, 32, "I", NE)),
Expand Down

0 comments on commit f01d8cb

Please sign in to comment.