File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,17 @@ def test_sync_transport_rejects_non_string_header_pairs():
2828 SyncTransport (api_key = "test-key" , headers = {"X-Correlation-Id" : 123 }) # type: ignore[dict-item]
2929
3030
31+ def test_sync_transport_rejects_string_subclass_header_values ():
32+ class _HeaderValue (str ):
33+ pass
34+
35+ with pytest .raises (HyperbrowserError , match = "headers must be a mapping" ):
36+ SyncTransport (
37+ api_key = "test-key" ,
38+ headers = {"X-Correlation-Id" : _HeaderValue ("trace" )},
39+ )
40+
41+
3142def test_sync_transport_rejects_invalid_api_key_values ():
3243 with pytest .raises (HyperbrowserError , match = "api_key must be a string" ):
3344 SyncTransport (api_key = None ) # type: ignore[arg-type]
@@ -96,6 +107,17 @@ def test_async_transport_rejects_non_string_header_pairs():
96107 AsyncTransport (api_key = "test-key" , headers = {"X-Correlation-Id" : 123 }) # type: ignore[dict-item]
97108
98109
110+ def test_async_transport_rejects_string_subclass_header_values ():
111+ class _HeaderValue (str ):
112+ pass
113+
114+ with pytest .raises (HyperbrowserError , match = "headers must be a mapping" ):
115+ AsyncTransport (
116+ api_key = "test-key" ,
117+ headers = {"X-Correlation-Id" : _HeaderValue ("trace" )},
118+ )
119+
120+
99121def test_async_transport_rejects_invalid_api_key_values ():
100122 with pytest .raises (HyperbrowserError , match = "api_key must be a string" ):
101123 AsyncTransport (api_key = None ) # type: ignore[arg-type]
You can’t perform that action at this time.
0 commit comments