Skip to content

Commit

Permalink
fix: sweep up
Browse files Browse the repository at this point in the history
  • Loading branch information
scanny committed Dec 14, 2024
1 parent d0a2da2 commit c17218a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ lint.select = [
lint.ignore = [
"COM812", # -- over aggressively insists on trailing commas where not desireable --
"PT001", # -- wants empty parens on @pytest.fixture where not used (essentially always) --
"PT005", # -- flags mock fixtures with names intentionally matching private method name --
"PT011", # -- pytest.raises({exc}) too broad, use match param or more specific exception --
"PT012", # -- pytest.raises() block should contain a single simple statement --
"SIM117", # -- merge `with` statements for context managers that have same scope --
Expand Down
13 changes: 7 additions & 6 deletions test_unstructured/partition/test_docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ def test_partition_docx_with_spooled_file(
`python-docx` will NOT accept a `SpooledTemporaryFile` in Python versions before 3.11 so we need
to ensure the source file is appropriately converted in this case.
"""
with open(mock_document_file_path, "rb") as test_file:
spooled_temp_file = tempfile.SpooledTemporaryFile()
spooled_temp_file.write(test_file.read())
with tempfile.SpooledTemporaryFile() as spooled_temp_file:
with open(mock_document_file_path, "rb") as test_file:
spooled_temp_file.write(test_file.read())
spooled_temp_file.seek(0)

elements = partition_docx(file=spooled_temp_file)
assert elements == expected_elements
for element in elements:
assert element.metadata.filename is None

assert elements == expected_elements
assert all(e.metadata.filename is None for e in elements)


def test_partition_docx_from_file(mock_document_file_path: str, expected_elements: list[Text]):
Expand Down

0 comments on commit c17218a

Please sign in to comment.