Skip to content

Commit a78b1a6

Browse files
committed
test
1 parent 62bb644 commit a78b1a6

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ __pycache__/
1212
.idea/
1313
openapi.json
1414
openapi_client.json
15+
16+
# Environments
17+
.env
18+
.envrc
19+
.venv*
20+
venv*
21+
env/
22+
ENV/
23+
env.bak/

_test_unstructured_client/integration/test_decorators.py

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

33
import tempfile
44
from pathlib import Path
5+
from typing import Literal
56

67
import httpx
78
import json
@@ -15,6 +16,7 @@
1516
from unstructured_client import UnstructuredClient
1617
from unstructured_client.models import shared, operations
1718
from unstructured_client.models.errors import HTTPValidationError
19+
from unstructured_client.models.shared.partition_parameters import Strategy
1820
from unstructured_client.utils.retries import BackoffStrategy, RetryConfig
1921
from unstructured_client._hooks.custom import form_utils
2022
from unstructured_client._hooks.custom import split_pdf_hook
@@ -106,8 +108,8 @@ def test_integration_split_pdf_has_same_output_as_non_split(
106108
assert len(diff) == 0
107109

108110
@pytest.mark.parametrize( ("filename", "expected_ok", "strategy"), [
109-
("_sample_docs/layout-parser-paper.pdf", True, "hi_res"), # 16
110-
]# pages
111+
("_sample_docs/layout-parser-paper.pdf", True, shared.Strategy.HI_RES), # 16 pages
112+
]
111113
)
112114
@pytest.mark.parametrize( ("use_caching", "cache_dir"), [
113115
(True, None), # Use default cache dir
@@ -116,8 +118,11 @@ def test_integration_split_pdf_has_same_output_as_non_split(
116118
(False, Path(tempfile.gettempdir()) / "test_integration_unstructured_client2"), # Don't use caching, use custom cache dir
117119
])
118120
def test_integration_split_pdf_with_caching(
119-
filename: str, expected_ok: bool, strategy: str, use_caching: bool,
120-
cache_dir: Path | None
121+
filename: str,
122+
expected_ok: bool,
123+
strategy: Literal[Strategy.HI_RES],
124+
use_caching: bool,
125+
cache_dir: Path | None,
121126
):
122127
try:
123128
response = requests.get("http://localhost:8000/general/docs")
@@ -143,7 +148,7 @@ def test_integration_split_pdf_with_caching(
143148
languages=["eng"],
144149
split_pdf_page=True,
145150
split_pdf_cache_tmp_data=use_caching,
146-
split_pdf_cache_dir=cache_dir,
151+
split_pdf_cache_tmp_data_dir=str(cache_dir),
147152
)
148153

149154
req = operations.PartitionRequest(

0 commit comments

Comments
 (0)