Skip to content

Conversation

@AkashS0510
Copy link
Collaborator

@AkashS0510 AkashS0510 commented May 13, 2025

Pull Request Template

This pull request enhances the evaluator modules by introducing the json_format_value utility 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:

  • Updated all evaluator modules to use json_format_value for formatting values in evaluation messages, improving the readability of outputs. This change affects evaluators such as contained_in, contains, equals, greater_than, greater_than_equal_to, is_empty, is_not_empty, less_than, less_than_equal_to, and not_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?

    • Related issue: #

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Other (please specify):

Checklist

  • Code has been linted.
  • Documentation has been updated (if needed).
  • Tests have been added or updated (if needed).
  • Any breaking changes have been communicated to the team.

Screenshots or Recordings (if applicable)

image

Additional Information

@codecov
Copy link

codecov bot commented May 13, 2025

Codecov Report

Attention: Patch coverage is 97.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/tirith/core/evaluators/not_contained_in.py 87.50% 1 Missing ⚠️
src/tirith/core/evaluators/not_contains.py 87.50% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/tirith/core/evaluators/contained_in.py 73.46% <100.00%> (ø)
src/tirith/core/evaluators/contains.py 73.46% <100.00%> (ø)
src/tirith/core/evaluators/equals.py 87.50% <100.00%> (+0.54%) ⬆️
src/tirith/core/evaluators/greater_than.py 84.21% <100.00%> (+4.21%) ⬆️
...rc/tirith/core/evaluators/greater_than_equal_to.py 83.33% <100.00%> (+3.33%) ⬆️
src/tirith/core/evaluators/is_empty.py 82.35% <100.00%> (+3.78%) ⬆️
src/tirith/core/evaluators/is_not_empty.py 80.00% <100.00%> (+1.42%) ⬆️
src/tirith/core/evaluators/less_than.py 83.33% <100.00%> (+3.33%) ⬆️
src/tirith/core/evaluators/less_than_equal_to.py 83.33% <100.00%> (+3.33%) ⬆️
src/tirith/core/evaluators/not_equals.py 87.50% <100.00%> (+0.54%) ⬆️
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@refeed refeed left a 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 refeed changed the title Encode message Fix #252 enhan: Make result message more readable by json encoding it May 13, 2025
refeed
refeed previously approved these changes May 13, 2025
Copy link
Member

@refeed refeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arunim2405 arunim2405 requested a review from Copilot May 13, 2025 10:29
Copy link

Copilot AI left a 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_value in tirith/utils.py for JSON-string formatting of values.
  • Updated each evaluator in src/tirith/core/evaluators/ to call json_format_value when 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_passing but is marked as failing. Rename it to test_evaluate_failing to 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:

@sonarqubecloud
Copy link

@refeed refeed merged commit 9774f0f into main May 13, 2025
22 checks passed
@refeed refeed deleted the encode_message branch May 13, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants