From c9653a5bdf6d0fa657d68b574af6a496f2c1d983 Mon Sep 17 00:00:00 2001 From: Guilhem de Viry Date: Thu, 7 Nov 2024 11:07:42 +0100 Subject: [PATCH] test incompatible settings ascii_tables & tbl_formatting --- py-polars/tests/unit/dataframe/test_show.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/py-polars/tests/unit/dataframe/test_show.py b/py-polars/tests/unit/dataframe/test_show.py index df2734b32cf7..7e5e5d593da0 100644 --- a/py-polars/tests/unit/dataframe/test_show.py +++ b/py-polars/tests/unit/dataframe/test_show.py @@ -1,6 +1,7 @@ import pytest import polars as pl +from polars.config import TableFormatNames def test_df_show_default(capsys: pytest.CaptureFixture[str]) -> None: @@ -134,6 +135,24 @@ def test_df_show_ascii_tables(capsys: pytest.CaptureFixture[str]) -> None: ) +@pytest.mark.parametrize( + ("ascii_tables", "tbl_formatting"), + [ + (True, "ASCII_FULL_CONDENSED"), + (True, "UTF8_FULL_CONDENSED"), + (False, "ASCII_FULL_CONDENSED"), + (False, "UTF8_FULL_CONDENSED"), + ], +) +def test_df_show_cannot_set_ascii_tables_and_tbl_formatting( + ascii_tables: bool, tbl_formatting: TableFormatNames +) -> None: + df = pl.DataFrame() + + with pytest.raises(ValueError): + df.show(ascii_tables=ascii_tables, tbl_formatting=tbl_formatting) + + @pl.Config(decimal_separator=",") def test_df_show_decimal_separator(capsys: pytest.CaptureFixture[str]) -> None: df = pl.DataFrame({"v": [9876.54321, 1010101.0, -123456.78]})