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_show.py
7884 views
1
from inspect import signature
2
from unittest.mock import patch
3
4
import pytest
5
6
import polars as pl
7
8
9
def test_show_signature_match() -> None:
10
assert signature(pl.LazyFrame.show) == signature(pl.DataFrame.show)
11
12
13
def test_lf_show_calls_df_show() -> None:
14
lf = pl.LazyFrame({})
15
with patch.object(pl.DataFrame, "show") as df_show:
16
lf.show(5)
17
18
df_show.assert_called_once_with(
19
5,
20
ascii_tables=None,
21
decimal_separator=None,
22
thousands_separator=None,
23
float_precision=None,
24
fmt_float=None,
25
fmt_str_lengths=None,
26
fmt_table_cell_list_len=None,
27
tbl_cell_alignment=None,
28
tbl_cell_numeric_alignment=None,
29
tbl_cols=None,
30
tbl_column_data_type_inline=None,
31
tbl_dataframe_shape_below=None,
32
tbl_formatting=None,
33
tbl_hide_column_data_types=None,
34
tbl_hide_column_names=None,
35
tbl_hide_dtype_separator=None,
36
tbl_hide_dataframe_shape=None,
37
tbl_width_chars=None,
38
trim_decimal_zeros=True,
39
)
40
41
42
def test_lf_show_no_limit_raises() -> None:
43
lf = pl.LazyFrame({})
44
with pytest.raises(ValueError):
45
lf.show(limit=None)
46
47