From 99a41726c15e49a248d32d6cbf88da2c78e24d6f Mon Sep 17 00:00:00 2001 From: John <43506685+Coniferish@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:58:37 -0400 Subject: [PATCH] move test --- .../integration/test_decorators.py | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/_test_unstructured_client/integration/test_decorators.py b/_test_unstructured_client/integration/test_decorators.py index 97391cfc..987a73e8 100644 --- a/_test_unstructured_client/integration/test_decorators.py +++ b/_test_unstructured_client/integration/test_decorators.py @@ -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"), @@ -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" - )