11from http .server import BaseHTTPRequestHandler
2- from typing import List , Iterator
2+ from typing import Iterator , List
33
44import pytest
55import requests
66
7- from databricks .sdk ._base_client import _BaseClient , _StreamingResponse
87from databricks .sdk import errors , useragent
8+ from databricks .sdk ._base_client import _BaseClient , _StreamingResponse
99from databricks .sdk .core import DatabricksError
1010
1111from .clock import FakeClock
@@ -59,7 +59,7 @@ def test_streaming_response_read_closes(config):
5959@pytest .mark .parametrize ('status_code,headers,body,expected_error' , [
6060 (400 , {}, {
6161 "message" :
62- "errorMessage" ,
62+ "errorMessage" ,
6363 "details" : [{
6464 "type" : DatabricksError ._error_info_type ,
6565 "reason" : "error reason" ,
@@ -88,23 +88,21 @@ def test_streaming_response_read_closes(config):
8888 (401 , {}, {
8989 'error_code' : 'UNAUTHORIZED' ,
9090 'message' : 'errorMessage' ,
91- },
92- errors .Unauthenticated ('errorMessage' , error_code = 'UNAUTHORIZED' )),
91+ }, errors .Unauthenticated ('errorMessage' , error_code = 'UNAUTHORIZED' )),
9392 (403 , {}, {
9493 'error_code' : 'FORBIDDEN' ,
9594 'message' : 'errorMessage' ,
96- },
97- errors .PermissionDenied ('errorMessage' , error_code = 'FORBIDDEN' )),
95+ }, errors .PermissionDenied ('errorMessage' , error_code = 'FORBIDDEN' )),
9896 (429 , {}, {
9997 'error_code' : 'TOO_MANY_REQUESTS' ,
10098 'message' : 'errorMessage' ,
10199 }, errors .TooManyRequests ('errorMessage' , error_code = 'TOO_MANY_REQUESTS' , retry_after_secs = 1 )),
102100 (429 , {
103101 'Retry-After' : '100'
104102 }, {
105- 'error_code' : 'TOO_MANY_REQUESTS' ,
106- 'message' : 'errorMessage' ,
107- }, errors .TooManyRequests ('errorMessage' , error_code = 'TOO_MANY_REQUESTS' , retry_after_secs = 100 )),
103+ 'error_code' : 'TOO_MANY_REQUESTS' ,
104+ 'message' : 'errorMessage' ,
105+ }, errors .TooManyRequests ('errorMessage' , error_code = 'TOO_MANY_REQUESTS' , retry_after_secs = 100 )),
108106 (503 , {}, {
109107 'error_code' : 'TEMPORARILY_UNAVAILABLE' ,
110108 'message' : 'errorMessage' ,
@@ -113,9 +111,9 @@ def test_streaming_response_read_closes(config):
113111 (503 , {
114112 'Retry-After' : '100'
115113 }, {
116- 'error_code' : 'TEMPORARILY_UNAVAILABLE' ,
117- 'message' : 'errorMessage' ,
118- },
114+ 'error_code' : 'TEMPORARILY_UNAVAILABLE' ,
115+ 'message' : 'errorMessage' ,
116+ },
119117 errors .TemporarilyUnavailable ('errorMessage' , error_code = 'TEMPORARILY_UNAVAILABLE' ,
120118 retry_after_secs = 100 )),
121119 (404 , {}, {
@@ -217,7 +215,7 @@ def inner(h: BaseHTTPRequestHandler):
217215 with http_fixture_server (inner ) as host :
218216 api_client = _BaseClient (retry_timeout_seconds = 1 , clock = FakeClock ())
219217 with pytest .raises (TimeoutError ):
220- res = api_client .do ('GET' , f'{ host } /foo' )
218+ api_client .do ('GET' , f'{ host } /foo' )
221219
222220 assert len (requests ) == 1
223221
@@ -278,5 +276,3 @@ def inner(h: BaseHTTPRequestHandler):
278276 assert 'foo' in res
279277
280278 assert len (requests ) == 2
281-
282-
0 commit comments