fix(auto): quick fix for auto test failing in CI (#3715)

Better fix to follow.
This commit is contained in:
Steve Canny 2024-10-10 11:44:00 -07:00 committed by GitHub
parent 06c85235ee
commit 2f496f867c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 24 deletions

View File

@ -1,4 +1,4 @@
## 0.15.14-dev13 ## 0.15.14-dev14
### Enhancements ### Enhancements
@ -18,6 +18,7 @@
* **Remove obsolete min_partition/max_partition args from TXT and EML.** The legacy `min_partition` and `max_partition` parameters were an initial rough implementation of chunking but now interfere with chunking and are unused. Remove those parameters from `partition_text()` and `partition_email()`. * **Remove obsolete min_partition/max_partition args from TXT and EML.** The legacy `min_partition` and `max_partition` parameters were an initial rough implementation of chunking but now interfere with chunking and are unused. Remove those parameters from `partition_text()` and `partition_email()`.
* **Remove double-decoration on EML and MSG.** Refactor these partitioners to rely on the new `@apply_metadata()` decorator operating on partitioners they delegate to (TXT, HTML, and all others for attachments) and remove direct decoration from EML and MSG. * **Remove double-decoration on EML and MSG.** Refactor these partitioners to rely on the new `@apply_metadata()` decorator operating on partitioners they delegate to (TXT, HTML, and all others for attachments) and remove direct decoration from EML and MSG.
* **Remove double-decoration for PPT.** Remove decorators from the delegating PPT partitioner. * **Remove double-decoration for PPT.** Remove decorators from the delegating PPT partitioner.
* **Quick-fix CI error in auto test-filetype.** Better fix to follow shortly.
## 0.15.13 ## 0.15.13

View File

@ -1207,35 +1207,39 @@ def test_auto_partition_overwrites_any_filetype_applied_by_file_specific_partiti
@pytest.mark.parametrize( @pytest.mark.parametrize(
"file_type", ("file_name", "file_type"),
[ [
t ("stanley-cups.csv", FileType.CSV),
for t in FileType ("simple.doc", FileType.DOC),
if t ("simple.docx", FileType.DOCX),
not in ( ("fake-email.eml", FileType.EML),
FileType.EMPTY, ("simple.epub", FileType.EPUB),
FileType.JSON, ("fake-html.html", FileType.HTML),
FileType.UNK, ("README.md", FileType.MD),
FileType.WAV, ("fake-email.msg", FileType.MSG),
FileType.XLS, ("simple.odt", FileType.ODT),
FileType.ZIP, ("pdf/DA-1p.pdf", FileType.PDF),
) ("fake-power-point.ppt", FileType.PPT),
and t.partitioner_shortname != "image" ("simple.pptx", FileType.PPTX),
("README.rst", FileType.RST),
("fake-doc.rtf", FileType.RTF),
("stanley-cups.tsv", FileType.TSV),
("fake-text.txt", FileType.TXT),
("tests-example.xls", FileType.XLSX),
("stanley-cups.xlsx", FileType.XLSX),
("factbook.xml", FileType.XML),
], ],
) )
def test_auto_partition_applies_the_correct_filetype_for_all_filetypes(file_type: FileType): def test_auto_partition_applies_the_correct_filetype_for_all_filetypes(
file_name: str, file_type: FileType
):
file_path = example_doc_path(file_name)
partition_fn_name = file_type.partitioner_function_name partition_fn_name = file_type.partitioner_function_name
module = import_module(file_type.partitioner_module_qname) module = import_module(file_type.partitioner_module_qname)
partition_fn = getattr(module, partition_fn_name) partition_fn = getattr(module, partition_fn_name)
# -- partition the first example-doc with the extension for this filetype -- # -- partition the example-doc for this filetype --
elements: list[Element] = [] elements = partition_fn(file_path)
doc_path = example_doc_path("pdf") if file_type == FileType.PDF else example_doc_path("")
extensions = file_type._extensions
for file in pathlib.Path(doc_path).iterdir():
if file.is_file() and file.suffix in extensions:
elements = partition_fn(str(file))
break
assert elements assert elements
assert all( assert all(

View File

@ -1 +1 @@
__version__ = "0.15.14-dev13" # pragma: no cover __version__ = "0.15.14-dev14" # pragma: no cover