test(openai-agents-v2): improve test coverage #4098
+626
−0
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.
Description
This PR improves test coverage for the
opentelemetry-instrumentation-openai-agents-v2package by adding 66 new unit tests.Coverage Improvements
__init__.pyspan_processor.pyNew Test Coverage
The new tests cover previously untested code paths:
Helper Functions (
__init__.py):_resolve_system- System name resolution with enum matching_resolve_bool- Boolean parsing from various input types_resolve_content_mode- Content capture mode resolutionUtilities (
span_processor.py):normalize_provider- Provider name normalizationvalidate_tool_type- Tool type validationnormalize_output_type- Output type normalizationContentCaptureModeproperties (capture_in_span,capture_in_event)_get_span_namefor handoff/transcription/speech span types_infer_output_typefor function/embeddings/image/audio/json outputs_sanitize_usage_payloadfor dict and object usage payloads_normalize_messages_to_role_partsedge cases_normalize_to_text_partscontent normalization_collect_system_instructionsmessage collectionImplementation Notes
Type of change
Checklist