fix: correct mock targets in LocalEvalSetsManager tests#4373
fix: correct mock targets in LocalEvalSetsManager tests#4373G26karthik wants to merge 7 commits intogoogle:mainfrom
Conversation
Enhanced the LLM-as-judge prompt to explicitly handle non-English languages including Chinese, Thai, Japanese, Korean, Arabic, Hebrew, Hindi, and other non-Latin scripts. The evaluator now: - Recognizes identical strings in any language as valid matches - Handles Unicode and character encoding differences - Accepts language-specific punctuation variations (e.g., 。 vs . in Chinese) - Treats all languages with equal evaluation standards Fixes google#3111 Fixes google#3162
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Two tests were incorrectly mocking get_eval_case instead of get_eval_set: - test_local_eval_sets_manager_update_eval_case_eval_set_not_found - test_local_eval_sets_manager_delete_eval_case_eval_set_not_found The code path calls get_eval_set first via get_eval_set_from_app_and_id(), so these tests need to mock get_eval_set to return None to trigger the NotFoundError for eval set not found scenarios. This fixes the OSError that occurred when the actual file system was hit with an invalid path due to the fixture parameter issue.
Summary of ChangesHello @G26karthik, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where two unit tests in Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes two failing unit tests in test_local_eval_sets_manager.py. The tests for update_eval_case and delete_eval_case were incorrectly mocking get_eval_case instead of get_eval_set for 'eval set not found' scenarios. The change correctly updates the mock target, which resolves the test failures. The fix is accurate and the reasoning is well-documented in the pull request description. The changes look good.
|
Response from ADK Triaging Agent Hello @G26karthik, thank you for creating this PR! This PR is a bug fix. Could you please associate a GitHub issue with this PR? If there is no existing issue, could you please create one? This information will help reviewers to review your PR more efficiently. Thanks! |
|
Created issue #4374 to track this bug. This PR fixes the issue by changing the mock target from |
|
/gemini Now Is this PR Good to go to Maintainers |
|
Hello @G26karthik, Based on my review, this PR looks good to go! The changes effectively address the identified issue by correcting the mock targets in the This is a clear and targeted fix that improves the stability and correctness of the test suite. Well done on identifying and resolving the root cause! Feel free to proceed with merging this PR when you're ready. |
|
Hi @precision @AustinWise @rspier - minimal fix, all 29 tests now passing. Ready for review. 🙏 |
Summary
Fixes 2 failing unit tests in
test_local_eval_sets_manager.pythat were incorrectly mockingget_eval_caseinstead ofget_eval_set.Problem
The following tests were failing with
OSError: [Errno 22] Invalid argument:test_local_eval_sets_manager_update_eval_case_eval_set_not_foundtest_local_eval_sets_manager_delete_eval_case_eval_set_not_foundRoot Cause
Both
update_eval_case()anddelete_eval_case()callget_eval_set_from_app_and_id()first, which internally callsget_eval_set(). The tests were mockingget_eval_caseinstead ofget_eval_set, so the code path hit the actual file system.The error message showed an invalid path like:
This happened because the class fixture was receiving
selfas the first parameter instead oftmp_path.Fix
Changed the mock target from
get_eval_casetoget_eval_setwithreturn_value=None, which correctly triggers theNotFoundErrorfor "eval set not found" scenarios viaget_eval_set_from_app_and_id().Before
After
Testing
All 29 tests in
test_local_eval_sets_manager.pynow pass: