Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: partition_pdf() pass kwargs through fast strategy pipeline #3040

Merged
merged 11 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.13.8-dev15
## 0.13.8

### Enhancements

Expand Down
20 changes: 10 additions & 10 deletions test_unstructured/partition/pdf_image/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def test_partition_image_metadata_date(
):
mocked_last_modification_date = "2029-07-05T09:24:28"
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date",
return_value=mocked_last_modification_date,
)
elements = image.partition_image(filename=filename)
Expand All @@ -340,7 +340,7 @@ def test_partition_image_with_hi_res_strategy_metadata_date(
):
mocked_last_modification_date = "2029-07-05T09:24:28"
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date",
return_value=mocked_last_modification_date,
)
elements = image.partition_image(filename=filename, strategy=PartitionStrategy.HI_RES)
Expand All @@ -356,7 +356,7 @@ def test_partition_image_metadata_date_custom_metadata_date(
expected_last_modification_date = "2009-07-05T09:24:28"

mocker.patch(
"unstructured.partition.pdf.get_last_modified_date",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date",
return_value=mocked_last_modification_date,
)
elements = image.partition_image(
Expand All @@ -375,7 +375,7 @@ def test_partition_image_with_hi_res_strategy_metadata_date_custom_metadata_date
expected_last_modification_date = "2009-07-05T09:24:28"

mocker.patch(
"unstructured.partition.pdf.get_last_modified_date",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date",
return_value=mocked_last_modification_date,
)
elements = image.partition_image(
Expand All @@ -393,7 +393,7 @@ def test_partition_image_from_file_metadata_date(
):
mocked_last_modification_date = "2029-07-05T09:24:28"
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)
with open(filename, "rb") as f:
Expand All @@ -408,7 +408,7 @@ def test_partition_image_from_file_explicit_get_metadata_date(
):
mocked_last_modification_date = "2029-07-05T09:24:28"
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)
with open(filename, "rb") as f:
Expand All @@ -423,7 +423,7 @@ def test_partition_image_from_file_with_hi_res_strategy_metadata_date(
):
mocked_last_modification_date = "2029-07-05T09:24:28"
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)

Expand All @@ -439,7 +439,7 @@ def test_partition_image_from_file_with_hi_res_strategy_explicit_get_metadata_da
):
mocked_last_modification_date = "2029-07-05T09:24:28"
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)

Expand All @@ -459,7 +459,7 @@ def test_partition_image_from_file_metadata_date_custom_metadata_date(
expected_last_modification_date = "2009-07-05T09:24:28"

mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)
with open(filename, "rb") as f:
Expand All @@ -479,7 +479,7 @@ def test_partition_image_from_file_with_hi_res_strategy_metadata_date_custom_met
expected_last_modification_date = "2009-07-05T09:24:28"

mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)
with open(filename, "rb") as f:
Expand Down
4 changes: 2 additions & 2 deletions test_unstructured/partition/pdf_image/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,11 @@ def test_partition_pdf_metadata_date(
expected_last_modification_date = None

mocker.patch(
"unstructured.partition.pdf.get_last_modified_date_from_file",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date_from_file",
return_value=mocked_last_modification_date,
)
mocker.patch(
"unstructured.partition.pdf.get_last_modified_date",
"unstructured.partition.pdf_image.pdf_image_utils.get_last_modified_date",
return_value=mocked_last_modification_date,
)

Expand Down
2 changes: 1 addition & 1 deletion unstructured/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.13.8-dev15" # pragma: no cover
__version__ = "0.13.8" # pragma: no cover
Loading
Loading