Skip to content

[ContentUnderstanding] Precise page number assertions in content range tests#45793

Merged
changjian-wang merged 2 commits intochangjian-wang/add-contentrange-samples-doc-audio-videofrom
copilot/sub-pr-45679-again
Mar 19, 2026
Merged

[ContentUnderstanding] Precise page number assertions in content range tests#45793
changjian-wang merged 2 commits intochangjian-wang/add-contentrange-samples-doc-audio-videofrom
copilot/sub-pr-45679-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Content range assertions in test_sample_analyze_binary.py were too loose — checking > 0 or >= 2 instead of exact counts, and not verifying which pages were actually extracted.

Changes

  • Exact page count assertions: Replace loose bounds with assert == for all content range scenarios ("3-"full_page_count - 2, "1-3,5,9-"full_page_count - 4, "1,3-4"3)
  • Individual page number verification: Extract and sort page_number from each returned page, compare against expected list (e.g., "1-3"[1, 2, 3], "1,3-4"[1, 3, 4])
  • Endpoint assertions: Verify start_page_number/end_page_number on DocumentContent for all range scenarios
# Before: loose assertion
assert combine2_page_count >= 2

# After: exact count + specific page numbers
assert combine2_page_count == 3
actual_combine2_pages = sorted([p.page_number for p in combine2_doc.pages])
assert actual_combine2_pages == [1, 3, 4]

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…_content_range

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] Precise page number assertions in content range tests Mar 19, 2026
Copilot AI requested a review from changjian-wang March 19, 2026 08:24
@changjian-wang changjian-wang marked this pull request as ready for review March 19, 2026 08:25
@changjian-wang changjian-wang merged commit 0a2a6c3 into changjian-wang/add-contentrange-samples-doc-audio-video Mar 19, 2026
6 checks passed
@changjian-wang changjian-wang deleted the copilot/sub-pr-45679-again branch March 19, 2026 08:26
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