-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12950fd
commit 58dfbe9
Showing
4 changed files
with
43 additions
and
62 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
|
||
from marker.schema import BlockTypes | ||
|
||
|
||
@pytest.mark.config({"page_range": [0]}) | ||
@pytest.mark.filename("adversarial_rot.pdf") | ||
def test_rotated_bboxes(pdf_document): | ||
first_page = pdf_document.pages[0] | ||
|
||
# Ensure we match all text lines up properly | ||
text_lines = first_page.contained_blocks(pdf_document, (BlockTypes.Line,)) | ||
text_blocks = first_page.contained_blocks(pdf_document, (BlockTypes.Text,)) | ||
assert len(text_lines) == 97 | ||
|
||
# Ensure the bbox sizes match up | ||
max_line_position = max([line.polygon.x_end for line in text_lines]) | ||
max_block_position = max([block.polygon.x_end for block in text_blocks if block.source == "layout"]) | ||
assert max_line_position <= max_block_position |