Skip to content

Commit 0032b92

Browse files
committed
Fix contract tests and bump version to 0.41.0
1 parent ea6731a commit 0032b92

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 0.41.0
2+
3+
### Enhancements
4+
5+
### Features
6+
* Provide a base `UnstructuredClientError` to capture every error raised by the SDK. Note that some exceptions such as `SDKError` now have more information in the `message` field. This will impact any users who rely on string matching in their error handling.
7+
8+
### Fixes
9+
110
## 0.37.3
211

312
### Enhancements

_test_contract/platform_api/test_destinations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_list_destinations_5xx_code(
108108
)
109109
requests = httpx_mock.get_requests()
110110
assert len(requests) >= 1
111-
assert excinfo.value.message == "API error occurred"
111+
assert "API error occurred" in excinfo.value.message
112112
assert excinfo.value.status_code == error_status_code
113113

114114

@@ -177,7 +177,7 @@ def test_get_destination_not_found(
177177

178178
requests = httpx_mock.get_requests()
179179
assert len(requests) == 1
180-
assert excinfo.value.message == "API error occurred"
180+
assert "API error occurred" in excinfo.value.message
181181
assert excinfo.value.status_code == 404
182182

183183

_test_contract/platform_api/test_jobs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_get_job_not_found(
101101
)
102102

103103
assert e.value.status_code == 404
104-
assert e.value.message == "API error occurred"
104+
assert "API error occurred" in e.value.message
105105

106106
requests = httpx_mock.get_requests()
107107
assert len(requests) == 1
@@ -130,7 +130,7 @@ def test_get_job_error(httpx_mock, platform_client: UnstructuredClient, platform
130130
)
131131

132132
assert e.value.status_code == 500
133-
assert e.value.message == "API error occurred"
133+
assert "API error occurred" in e.value.message
134134

135135
requests = httpx_mock.get_requests()
136136
assert len(requests) == 4

_test_contract/platform_api/test_sources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_list_sources_5xx_code(
110110
platform_client.sources.list_sources(request=operations.ListSourcesRequest())
111111
requests = httpx_mock.get_requests()
112112
assert len(requests) >= 1
113-
assert excinfo.value.message == "API error occurred"
113+
assert "API error occurred" in excinfo.value.message
114114
assert excinfo.value.status_code == error_status_code
115115

116116

@@ -176,7 +176,7 @@ def test_get_source_not_found(
176176

177177
requests = httpx_mock.get_requests()
178178
assert len(requests) == 1
179-
assert excinfo.value.message == "API error occurred"
179+
assert "API error occurred" in excinfo.value.message
180180
assert excinfo.value.status_code == 404
181181

182182

_test_contract/platform_api/test_workflows.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from unstructured_client import UnstructuredClient
66
from unstructured_client.models import shared, operations
7-
from unstructured_client.models.errors import SDKError
7+
from unstructured_client.models.errors import UnstructuredClientError
88

99

1010
def test_list_workflows(httpx_mock, platform_client: UnstructuredClient, platform_api_url: str):
@@ -108,10 +108,10 @@ def test_list_workflows_error(
108108
status_code=error_status_code,
109109
)
110110

111-
with pytest.raises(SDKError) as excinfo:
111+
with pytest.raises(UnstructuredClientError) as error:
112112
platform_client.workflows.list_workflows(request=operations.ListWorkflowsRequest())
113-
assert excinfo.value.status_code == error_status_code
114-
assert excinfo.value.message == "API error occurred"
113+
assert error.value.status_code == error_status_code
114+
assert "API error occurred" in error.value.message
115115

116116

117117
def test_create_workflow(httpx_mock, platform_client: UnstructuredClient, platform_api_url: str):

gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ generation:
1414
oAuth2ClientCredentialsEnabled: false
1515
oAuth2PasswordEnabled: false
1616
python:
17-
version: 0.40.0
17+
version: 0.41.0
1818
additionalDependencies:
1919
dev:
2020
deepdiff: '>=6.0'

0 commit comments

Comments
 (0)