Skip to content

[ContentUnderstanding] Tighten test assertions in test_sample_analyze_binary.py and test_sample_analyze_url.py#45791

Open
Copilot wants to merge 3 commits intochangjian-wang/add-contentrange-samples-doc-audio-videofrom
copilot/sub-pr-45679
Open

[ContentUnderstanding] Tighten test assertions in test_sample_analyze_binary.py and test_sample_analyze_url.py#45791
Copilot wants to merge 3 commits intochangjian-wang/add-contentrange-samples-doc-audio-videofrom
copilot/sub-pr-45679

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Test helper methods used soft if-guarded checks instead of hard assertions, and content range tests lacked precise boundary checks. This replaces defensive patterns with direct assertions throughout.

Helper method improvements (both files)

  • _test_markdown_extraction: removed soft if markdown: guard; added isinstance(content, DocumentContent) type check; asserts content.markdown is non-empty
  • _test_document_properties: replaced getattr(..., None) + if field: patterns with direct attribute access on Required fields (mime_type, start_page_number, end_page_number); added isinstance check

test_sample_analyze_url.py — AV/audio helpers

  • _test_audiovisual_properties / _test_audio_properties: added isinstance(content, AudioVisualContent); hard assertions on Required fields start_time_ms/end_time_ms; tightened end-time check to end_time_ms > start_time_ms; direct markdown assertion

test_sample_analyze_binary.py — content range precision

  • Full-document baseline: asserts pages is not None; asserts len(pages) == end_page_number
  • "3-": == full_page_count - 2 (was > 0); added start_page_number == 3, end_page_number == full_page_count
  • "1-3,5,9-": added start_page_number == 1, end_page_number == full_page_count
  • "1,3-4": == 3 (was >= 2); added end_page_number == 4

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…_sample_analyze_url.py

Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>
Copilot AI changed the title [WIP] [ContentUnderstanding] Add ContentRange samples for document, video, and audio [ContentUnderstanding] Tighten test assertions in test_sample_analyze_binary.py and test_sample_analyze_url.py Mar 19, 2026
Copilot AI requested a review from changjian-wang March 19, 2026 07:32
@changjian-wang changjian-wang marked this pull request as ready for review March 19, 2026 09:29
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.

2 participants