Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
Coniferish committed Oct 28, 2024
1 parent 2bcc8a3 commit 99a4172
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions _test_unstructured_client/integration/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@
FAKE_KEY = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"


@pytest.mark.parametrize("split_pdf_page", [True, False])
def test_integration_split_csv_response(split_pdf_page, client, doc_path):
filename = "layout-parser-paper.pdf"
with open(doc_path / filename, "rb") as f:
files = shared.Files(
content=f.read(),
file_name=filename,
)
req = operations.PartitionRequest(
partition_parameters=shared.PartitionParameters(
files=files,
output_format=OutputFormat.TEXT_CSV,
split_pdf_page=split_pdf_page,
)
)

resp = client.general.partition(request=req)

assert resp.status_code == 200
assert resp.content_type == "text/csv; charset=utf-8"
assert resp.elements is None
assert resp.csv_elements is not None
assert resp.csv_elements.startswith(
"type,element_id,text,filetype,languages,page_number,filename,parent_id"
)


@pytest.mark.parametrize("concurrency_level", [1, 2, 5])
@pytest.mark.parametrize(
("filename", "expected_ok", "strategy"),
Expand Down Expand Up @@ -375,30 +402,3 @@ async def mock_send(_, request: httpx.Request, **kwargs):
assert mock_endpoint_called

assert res.status_code == 200


@pytest.mark.parametrize("split_pdf_page", [True, False])
def test_integration_split_csv_response(split_pdf_page, client, doc_path):
filename = "layout-parser-paper.pdf"
with open(doc_path / filename, "rb") as f:
files = shared.Files(
content=f.read(),
file_name=filename,
)
req = operations.PartitionRequest(
partition_parameters=shared.PartitionParameters(
files=files,
output_format=OutputFormat.TEXT_CSV,
split_pdf_page=split_pdf_page,
)
)

resp = client.general.partition(request=req)

assert resp.status_code == 200
assert resp.content_type == "text/csv; charset=utf-8"
assert resp.elements is None
assert resp.csv_elements is not None
assert resp.csv_elements.startswith(
"type,element_id,text,filetype,languages,page_number,filename,parent_id"
)

0 comments on commit 99a4172

Please sign in to comment.