Skip to content

Commit 9dfd536

Browse files
committed
fix unit test and type hint
1 parent 7485332 commit 9dfd536

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

_test_unstructured_client/unit/test_request_utils.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

3-
# Get unit tests for request_utils.py module
43
import httpx
4+
import json
55
import pytest
66

77
from unstructured_client._hooks.custom.request_utils import create_pdf_chunk_request_params, create_response, get_multipart_stream_fields
@@ -87,10 +87,12 @@ def test_create_response_for_json():
8787

8888

8989
def test_create_response_for_csv():
90-
elements = 'type,element_id,text,languages,page_number,filename,filetype,parent_id' \
91-
'\nTitle,f73329878fbbb0bb131a83e7b6daacbe,Module One - Introduction to Product' \
92-
' Development and Quality Assurance,[\'eng\'],1,list-item-example-1.pdf,application/pdf,'
90+
elements = [
91+
b'type,element_id,text,languages,page_number,filename,filetype,parent_id' \
92+
b'\nTitle,f73329878fbbb0bb131a83e7b6daacbe,Module One - Introduction to Product' \
93+
b' Development and Quality Assurance,[\'eng\'],1,list-item-example-1.pdf,application/pdf,'
94+
]
9395
response = create_response(elements)
9496
assert response.status_code == 200
95-
assert response.json() == None
96-
assert response.headers["Content-Type"] == "text/csv"
97+
pytest.raises(json.decoder.JSONDecodeError, response.json)
98+
assert response.headers["Content-Type"] == "text/csv; charset=utf-8"

src/unstructured_client/_hooks/custom/request_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import io
55
import json
66
import logging
7-
from typing import Tuple, Any, BinaryIO
7+
from typing import Any, BinaryIO, Sequence, Tuple
88

99
import httpx
1010
from httpx._multipart import DataField, FileField

0 commit comments

Comments
 (0)