Skip to content

Commit

Permalink
fix: fix bug when disabling show_types in interactive repr
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored and cpcloud committed Dec 25, 2022
1 parent 40c5f0d commit 2402506
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,22 @@ def test_repr(alltypes, interactive):
ibis.options.interactive = old


@pytest.mark.parametrize("show_types", [True, False])
def test_interactive_repr_show_types(alltypes, show_types):
expr = alltypes.select("id")
old = ibis.options.interactive
ibis.options.interactive = True
ibis.options.repr.interactive.show_types = show_types
try:
s = repr(expr)
if show_types:
assert "int" in s
else:
assert "int" not in s
finally:
ibis.options.interactive = old


@pytest.mark.parametrize("expr_type", ["table", "column"])
@pytest.mark.parametrize("interactive", [True, False])
def test_repr_mimebundle(alltypes, interactive, expr_type):
Expand Down
2 changes: 1 addition & 1 deletion ibis/expr/types/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def add_row(*args, **kwargs):
else:
add_row = rich_table.add_row

if formatted_dtypes:
if ibis.options.repr.interactive.show_types:
add_row(
*(Align(s, align="left") for s in formatted_dtypes),
end_section=True,
Expand Down

0 comments on commit 2402506

Please sign in to comment.