File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,19 @@ def test_build_file_path_error_message_uses_open_default_when_default_prefix_inv
371371 assert message == "Failed to open file at path: /tmp/path.txt"
372372
373373
374+ def test_build_file_path_error_message_uses_open_default_when_default_prefix_is_string_subclass ():
375+ class _DefaultPrefix (str ):
376+ pass
377+
378+ message = build_file_path_error_message (
379+ "/tmp/path.txt" ,
380+ prefix = 123 , # type: ignore[arg-type]
381+ default_prefix = _DefaultPrefix ("Upload file not found at path" ),
382+ )
383+
384+ assert message == "Failed to open file at path: /tmp/path.txt"
385+
386+
374387def test_build_file_path_error_message_sanitizes_default_prefix_when_prefix_invalid ():
375388 message = build_file_path_error_message (
376389 "/tmp/path.txt" ,
@@ -409,6 +422,19 @@ def test_build_open_file_error_message_uses_explicit_default_prefix_when_prefix_
409422 assert message == "Failed to open upload file at path: /tmp/path.txt"
410423
411424
425+ def test_build_open_file_error_message_uses_open_default_when_default_prefix_is_string_subclass ():
426+ class _DefaultPrefix (str ):
427+ pass
428+
429+ message = build_open_file_error_message (
430+ "/tmp/path.txt" ,
431+ prefix = 123 , # type: ignore[arg-type]
432+ default_prefix = _DefaultPrefix ("Failed to open upload file at path" ),
433+ )
434+
435+ assert message == "Failed to open file at path: /tmp/path.txt"
436+
437+
412438def test_build_open_file_error_message_sanitizes_explicit_default_prefix_when_prefix_invalid ():
413439 message = build_open_file_error_message (
414440 "/tmp/path.txt" ,
You can’t perform that action at this time.
0 commit comments