test(events): add unit tests for Event helper methods#5948
Open
Koushik-Salammagari wants to merge 2 commits into
Open
test(events): add unit tests for Event helper methods#5948Koushik-Salammagari wants to merge 2 commits into
Koushik-Salammagari wants to merge 2 commits into
Conversation
Add a dedicated test module for the Event class, which previously had only incidental coverage. Covers is_final_response(), get_function_calls(), get_function_responses(), has_trailing_code_execution_result(), and automatic id generation, including edge cases such as events with no content, empty parts lists, and the skip_summarization / long_running_tool_ids early-return overrides.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Or, if no issue exists, describe the change:
Problem:
The
Eventclass's helper methods —is_final_response(),get_function_calls(),get_function_responses(),has_trailing_code_execution_result(), and automatic id generation inmodel_post_init— had no dedicated unit tests. They were only exercised incidentally through higher-level tests, and there was notests/unittests/events/package at all. This left several branches (early-return overrides, empty-content edge cases) without direct coverage.Solution:
Add
tests/unittests/events/test_event.pywith focused, isolated unit tests for these methods, including edge cases:is_final_response()— plain/empty events are final; function-call/response,partial, and trailing code-execution results are not final;skip_summarizationandlong_running_tool_idsearly-return overrides.get_function_calls()/get_function_responses()— ordering, no-content, empty-parts, and text-only cases.has_trailing_code_execution_result()— last vs. non-last part, no-content, and empty-parts cases.These are pure-logic tests with no external dependencies; no runtime behavior is changed.
Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
N/A — this is a test-only change and does not modify any runtime behavior.
Checklist