-
Notifications
You must be signed in to change notification settings - Fork 39
enhan: Make result message more readable by json encoding it #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
refeed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, would you please post a screenshot of what the results look like now?
refeed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a json_format_value helper to wrap evaluation values in JSON-style backticks, updates all evaluator modules to use it for consistent, readable messages, and adjusts tests to match the new formatting.
- Added
json_format_valueintirith/utils.pyfor JSON-string formatting of values. - Updated each evaluator in
src/tirith/core/evaluators/to calljson_format_valuewhen building their result messages. - Modified tests in
tests/core/evaluators/to assert messages now include JSON formatting/backticks.
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/tirith/utils.py | Adds json_format_value utility for formatting values. |
| src/tirith/core/evaluators/* | Refactors message strings to use json_format_value. |
| tests/core/evaluators/* | Updates test assertions to expect JSON-formatted values. |
Comments suppressed due to low confidence (2)
tests/core/evaluators/test_is_not_empty.py:20
- The second test function is named
test_evaluate_passingbut is marked as failing. Rename it totest_evaluate_failingto avoid duplicate test names.
def test_evaluate_passing():
src/tirith/utils.py:8
- Consider adding unit tests for
json_format_value, including cases for non-serializable objects to verify the fallback path.
def json_format_value(value: Any) -> str:
|



Pull Request Template
This pull request enhances the evaluator modules by introducing the
json_format_valueutility function to improve the readability of evaluation messages and adds missing imports for logging and type hints where necessary. These changes ensure that the evaluation results are more user-friendly and consistent across all evaluators.Improvements to evaluation messages:
json_format_valuefor formatting values in evaluation messages, improving the readability of outputs. This change affects evaluators such ascontained_in,contains,equals,greater_than,greater_than_equal_to,is_empty,is_not_empty,less_than,less_than_equal_to, andnot_contained_in.Code consistency and maintainability:
Description
What changes are being made?
Why are these changes necessary?
Which issues or tickets does this PR close or relate to?
Type of Change
Checklist
Screenshots or Recordings (if applicable)
Additional Information