Skip to content

Commit

Permalink
rfctr(auto): improve typing and organize auto tests (#3355)
Browse files Browse the repository at this point in the history
**Summary**
In preparation for further work on auto-partitioning (`partition()`),
improve typing and organize `test_auto.py` by introducing categories.
  • Loading branch information
scanny committed Jul 8, 2024
1 parent 609a08a commit d48fa3b
Show file tree
Hide file tree
Showing 4 changed files with 817 additions and 637 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.14.10-dev12
## 0.14.10-dev13

### Enhancements

Expand Down
12 changes: 9 additions & 3 deletions test_unstructured/partition/pdf_image/test_pdf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import base64
import logging
import math
Expand All @@ -17,6 +19,7 @@
from unstructured.documents.coordinates import PixelSpace
from unstructured.documents.elements import (
CoordinatesMetadata,
Element,
ElementMetadata,
ElementType,
Footer,
Expand Down Expand Up @@ -1182,11 +1185,14 @@ def test_extractable_elements_repair_invalid_pdf_structure(filename, expected_lo


def assert_element_extraction(
elements, extract_image_block_types, extract_image_block_to_payload, tmpdir
elements: list[Element],
extract_image_block_types: list[str],
extract_image_block_to_payload: bool,
tmpdir: str,
):
extracted_elements = []
extracted_elements: list[list[Element]] = []
for el_type in extract_image_block_types:
extracted_elements_by_type = []
extracted_elements_by_type: list[Element] = []
for el in elements:
if el.category == el_type:
extracted_elements_by_type.append(el)
Expand Down
Loading

0 comments on commit d48fa3b

Please sign in to comment.