Skip to content

Commit 45e4b28

Browse files
committed
fix typo and types
1 parent 297056a commit 45e4b28

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

_test_unstructured_client/unit/test_split_pdf_hook.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from unstructured_client._hooks.custom import form_utils, pdf_utils, request_utils
1616
from unstructured_client._hooks.custom.form_utils import (
17+
FormData,
1718
PARTITION_FORM_CONCURRENCY_LEVEL_KEY,
1819
PARTITION_FORM_STARTING_PAGE_NUMBER_KEY,
1920
PARTITION_FORM_PAGE_RANGE_KEY,
@@ -442,7 +443,7 @@ def test_unit_get_split_pdf_cache_tmp_data_dir_uses_dir_from_form_data(mock_path
442443
# -- Create the form_data
443444
dir_key = form_utils.PARTITION_FORM_SPLIT_CACHE_TMP_DATA_DIR_KEY # -- "split_pdf_cache_tmp_data_dir"
444445
mock_dir = "/mock/dir"
445-
form_data = {dir_key: mock_dir}
446+
form_data: FormData = {dir_key: mock_dir}
446447

447448
# -- Mock the Path object in form_utils
448449
mock_path_instance = MagicMock()
@@ -457,7 +458,7 @@ def test_unit_get_split_pdf_cache_tmp_data_dir_uses_dir_from_form_data(mock_path
457458
)
458459

459460
assert dir_key == "split_pdf_cache_tmp_data_dir"
460-
assert form_data.get(dir_key) == "/mock/existing/dir"
461+
assert form_data.get(dir_key) == "/mock/dir"
461462
mock_path.assert_called_once_with(mock_dir)
462463
mock_path_instance.exists.assert_called_once()
463464
assert result == str(Path(mock_dir).resolve())

src/unstructured_client/_hooks/custom/form_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44
from pathlib import Path
5-
from typing import TYPE_CHECKING, Mapping
5+
from typing import TYPE_CHECKING
66
from typing_extensions import TypeAlias
77

88
from requests_toolbelt.multipart.decoder import MultipartDecoder # type: ignore
@@ -14,7 +14,7 @@
1414
from typing import Union
1515

1616
logger = logging.getLogger(UNSTRUCTURED_CLIENT_LOGGER_NAME)
17-
FormData: TypeAlias = "Mapping[str, Union[str, shared.Files, list[str]]]"
17+
FormData: TypeAlias = "dict[str, Union[str, shared.Files, list[str]]]"
1818

1919
PARTITION_FORM_FILES_KEY = "files"
2020
PARTITION_FORM_SPLIT_PDF_PAGE_KEY = "split_pdf_page"

0 commit comments

Comments
 (0)