Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/py-polars/tests/unit/expr/test_meta.py
8416 views
1
import pytest
2
3
import polars as pl
4
5
6
def test_expression_hash_set() -> None:
7
a1 = pl.col("a")
8
a2 = pl.col("a")
9
b1 = pl.col("b") + 1
10
b2 = pl.col("b") + 2
11
b3 = pl.col("b") + 2
12
13
s = {e.meta for e in [a1, a2, b1, b2, b3]}
14
assert len(s) == 3
15
16
17
def test_hash_expr_hint() -> None:
18
a = pl.col("a")
19
20
with pytest.raises(
21
TypeError, match=r"""unhashable type: 'Expr'\n\nConsider hashing \'col.*meta"""
22
):
23
{a}
24
25