|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 |
| -# Get unit tests for request_utils.py module |
4 | 3 | import httpx
|
| 4 | +import json |
5 | 5 | import pytest
|
6 | 6 |
|
7 | 7 | 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():
|
87 | 87 |
|
88 | 88 |
|
89 | 89 | 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 | + ] |
93 | 95 | response = create_response(elements)
|
94 | 96 | 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" |
0 commit comments