@@ -256,11 +256,10 @@ def strip(self, chars=None): # type: ignore[override]
256256 assert isinstance (exc_info .value .original_error , TypeError )
257257
258258
259- def test_parse_response_model_wraps_operation_name_empty_check_length_failures ():
259+ def test_parse_response_model_wraps_operation_name_string_subclass_strip_results ():
260260 class _BrokenOperationName (str ):
261261 class _NormalizedName (str ):
262- def __len__ (self ):
263- raise RuntimeError ("operation name length exploded" )
262+ pass
264263
265264 def strip (self , chars = None ): # type: ignore[override]
266265 _ = chars
@@ -273,30 +272,19 @@ def strip(self, chars=None): # type: ignore[override]
273272 operation_name = _BrokenOperationName ("basic operation" ),
274273 )
275274
276- assert isinstance (exc_info .value .original_error , RuntimeError )
277-
278-
279- def test_parse_response_model_preserves_hyperbrowser_operation_name_empty_check_length_failures ():
280- class _BrokenOperationName (str ):
281- class _NormalizedName (str ):
282- def __len__ (self ):
283- raise HyperbrowserError ("custom operation name length failure" )
275+ assert isinstance (exc_info .value .original_error , TypeError )
284276
285- def strip (self , chars = None ): # type: ignore[override]
286- _ = chars
287- return self ._NormalizedName ("basic operation" )
288277
278+ def test_parse_response_model_rejects_blank_operation_names ():
289279 with pytest .raises (
290- HyperbrowserError , match = "custom operation name length failure "
291- ) as exc_info :
280+ HyperbrowserError , match = "operation_name must be a non-empty string "
281+ ):
292282 parse_response_model (
293283 {"success" : True },
294284 model = BasicResponse ,
295- operation_name = _BrokenOperationName ( "basic operation" ) ,
285+ operation_name = " " ,
296286 )
297287
298- assert exc_info .value .original_error is None
299-
300288
301289def test_parse_response_model_truncates_operation_name_in_errors ():
302290 long_operation_name = "basic operation " + ("x" * 200 )
0 commit comments