From 8a260a85c74ae2e6fad79100e3b6aee0fd2f6cb0 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Sun, 15 Sep 2024 05:32:47 -0400 Subject: [PATCH] fix(repr): remove expression printing from exception message (#10130) --- ibis/backends/tests/test_interactive.py | 16 ++++++++++++++++ ibis/expr/types/generic.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ibis/backends/tests/test_interactive.py b/ibis/backends/tests/test_interactive.py index 6acda4055866..05b40a3f72fd 100644 --- a/ibis/backends/tests/test_interactive.py +++ b/ibis/backends/tests/test_interactive.py @@ -16,6 +16,7 @@ import pytest import ibis +import ibis.common.exceptions as exc from ibis import config @@ -89,3 +90,18 @@ def test_isin_rule_suppressed_exception_repr_not_fail(table): expr = table.filter(bool_clause)["string_col"].value_counts() repr(expr) + + +def test_no_recursion_error(con, monkeypatch): + monkeypatch.setattr(ibis.options, "interactive", True) + monkeypatch.setattr(ibis.options, "default_backend", con) + + a = ibis.memtable({"a": [1]}) + b = ibis.memtable({"b": [1]}) + + expr = a.count() + b.count() + + with pytest.raises( + exc.RelationError, match="The scalar expression cannot be converted" + ): + repr(expr) diff --git a/ibis/expr/types/generic.py b/ibis/expr/types/generic.py index 76d357484c7e..68df1d4d88f3 100644 --- a/ibis/expr/types/generic.py +++ b/ibis/expr/types/generic.py @@ -1366,7 +1366,7 @@ def as_table(self) -> ir.Table: return parent.to_expr().aggregate(self) else: raise com.RelationError( - f"The scalar expression {self} cannot be converted to a " + "The scalar expression cannot be converted to a " "table expression because it involves multiple base table " "references" )