Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/py-polars/tests/unit/lazyframe/test_collect_schema.py
6939 views
1
from hypothesis import given
2
3
import polars as pl
4
from polars.testing.parametric import dataframes
5
6
7
@given(lf=dataframes(lazy=True))
8
def test_collect_schema_parametric(lf: pl.LazyFrame) -> None:
9
assert lf.collect_schema() == lf.collect().schema
10
11
12
def test_collect_schema() -> None:
13
lf = pl.LazyFrame(
14
{
15
"foo": [1, 2, 3],
16
"bar": [6.0, 7.0, 8.0],
17
"ham": ["a", "b", "c"],
18
}
19
)
20
result = lf.collect_schema()
21
expected = pl.Schema({"foo": pl.Int64(), "bar": pl.Float64(), "ham": pl.String()})
22
assert result == expected
23
24