Open
Conversation
adiadd
approved these changes
Mar 31, 2026
Contributor
|
Thanks for this @regularizer - would we be able to soundly address/change/adjust the failing test cases to be correct and aligned? |
adiadd
requested changes
Apr 1, 2026
Comment on lines
-311
to
-321
| def test_single_page_groups_excluded(self): | ||
| """Groups with only 1 page should not appear in ordering scores.""" | ||
| data = [ | ||
| _page("invoice", "inv-01", 1, "invoice", "inv-01", 1), | ||
| _page("form", "form-01", 2, "form", "form-01", 2), | ||
| ] | ||
| df = pd.DataFrame(data) | ||
| scores = calculate_ordering_score_per_group(df) | ||
| assert len(scores) == 0 | ||
| assert calculate_average_ordering_score(scores) == 0 | ||
|
|
Contributor
There was a problem hiding this comment.
logic change looks good but we're deleting the test for this code path without replacing it - can you swap in a test that asserts single-page groups now get 1.0 instead? something like:
def test_single_page_groups_score_perfect(self):
"""Single-page groups should receive a perfect ordering score of 1.0."""
data = [
_page("invoice", "inv-01", 1, "invoice", "inv-01", 1),
_page("form", "form-01", 2, "form", "form-01", 2),
]
df = pd.DataFrame(data)
scores = calculate_ordering_score_per_group(df)
assert len(scores) == 2
assert all(v == 1.0 for v in scores.values())
assert calculate_average_ordering_score(scores) == 1.0just wanna make sure the path we're changing stays covered. rest lgtm
adiadd
approved these changes
Apr 2, 2026
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.
Updated packet evaluation metric in doc_split module to cover single page documents in the packet.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.