Files
EvoScientist/tests/test_rich_escape.py
X-iZhang c5a4d559a2 Refactor test cases for improved readability and consistency
- Added blank lines for better separation of test cases in multiple test files.
- Reformatted event handling in tests for clarity and consistency.
- Ensured consistent use of multi-line formatting for dictionary arguments in event handling.
- Improved assertions and test descriptions for better understanding.
- Updated test cases across various modules including test_stream_state, test_stream_utils, test_summarization, test_thread_selector, test_tool_error_handler, test_tui_widgets, test_ui_runtime, and test_wechat_channel.
2026-03-15 21:12:51 +00:00

21 lines
768 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