Files
EvoScientist-Multi/tests/test_rich_escape.py
T
X-iZhang c57e6132a5 Add tests for Rich markup escape safety in formatter
- Introduced a new test file `test_rich_escape.py` to validate the safety of Rich markup escaping in the ToolResultFormatter.
- Added tests to ensure that tool names and error messages containing brackets do not cause crashes during formatting.
2026-02-22 17:15:11 +00:00

19 lines
746 B
Python

"""Tests for Rich markup escape safety in formatter."""
from EvoScientist.stream.formatter import ToolResultFormatter
class TestRichMarkupEscape:
def test_panel_title_with_brackets(self):
"""Tool name with brackets shouldn't crash formatter."""
formatter = ToolResultFormatter()
result = formatter.format("arr[0]", "[OK]\nDone", max_length=800)
# Should not raise — content is safely rendered
assert result.elements
def test_error_format_with_brackets(self):
"""Error content with markup-like text shouldn't crash."""
formatter = ToolResultFormatter()
result = formatter.format("test", "Error: expected [int] got [str]", max_length=800)
assert result.elements