File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
test_unstructured/partition/pdf_image
unstructured/partition/pdf_image Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11from PIL import Image
2-
2+ from unstructured_inference .constants import IsExtracted
3+ from unstructured_inference .inference .elements import Rectangle
34from unstructured_inference .inference .layout import DocumentLayout , PageLayout
45from unstructured_inference .inference .layoutelement import LayoutElement , LayoutElements
5- from unstructured_inference .inference .elements import Rectangle
6- from unstructured .partition .pdf_image .pdfminer_processing import merge_inferred_with_extracted_layout
7- from unstructured_inference .constants import IsExtracted
6+
7+ from unstructured .partition .pdf_image .pdfminer_processing import (
8+ merge_inferred_with_extracted_layout ,
9+ )
10+
811
912def test_text_source_preserved_during_merge ():
1013 """Test that text_source property is preserved when elements are merged."""
Original file line number Diff line number Diff line change 44import pytest
55from pdfminer .layout import LAParams
66from PIL import Image
7- from unstructured_inference .constants import Source as InferenceSource , IsExtracted
7+ from unstructured_inference .constants import IsExtracted
8+ from unstructured_inference .constants import Source as InferenceSource
89from unstructured_inference .inference .elements import (
910 EmbeddedTextRegion ,
1011 Rectangle ,
Original file line number Diff line number Diff line change @@ -128,7 +128,9 @@ def _merge_extracted_into_inferred_when_almost_the_same(
128128 extracted_to_remove = extracted_layout .slice (extracted_almost_the_same_as_inferred )
129129 # copy here in case we change the extracted layout later
130130 inferred_layout .texts [inferred_indices_to_update ] = extracted_to_remove .texts .copy ()
131- inferred_layout .is_extracted_array [inferred_indices_to_update ] = extracted_to_remove .is_extracted_array .copy ()
131+ inferred_layout .is_extracted_array [inferred_indices_to_update ] = (
132+ extracted_to_remove .is_extracted_array .copy ()
133+ )
132134 # use coords that can bound BOTH the inferred and extracted region as final bounding box coords
133135 inferred_layout .element_coords [inferred_indices_to_update ] = _minimum_containing_coords (
134136 inferred_layout .slice (inferred_indices_to_update ),
You can’t perform that action at this time.
0 commit comments