[Test] Add unit tests for srt/parser#20947
Conversation
Summary of ChangesHello, 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 substantially improves the unit test coverage for the 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. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves the test coverage for the srt/parser module by adding a comprehensive suite of unit tests. The new tests are well-structured, cover a wide range of scenarios including many edge cases, and follow good testing practices. The modifications to existing test files also represent clear improvements. I have one suggestion to make the tests even more robust and idiomatic by using unittest.mock.patch for managing global state in one of the new test files. Overall, this is a high-quality contribution that enhances the project's reliability.
88bccb0 to
42627c7
Compare
|
/tag-and-rerun-ci |
Motivation
Part of #20865 (srt/parser portion).
The
srt/parser/module had limited unit test coverage, withcode_completion_parser.pyandconversation.pyhaving none. This PR adds 306 tests across 5 files (2 new + 3 extended), covering all 5 source files undersrt/parser/. No server launch, no model weight loading.generate_chat_conv()tests use realChatCompletionRequestPydantic objects, andget_model_type()tests use real temp files.Coverage
The 12 remaining uncovered lines are internal defensive branches: malformed token handling in harmony_parser, AST type checks in jinja_template_utils, and streaming fallback paths in reasoning_parser.
Test plan