@@ -470,67 +470,3 @@ def test_streaming_unstructured_ingest_error_with_none_status_code():
470470 "Async gen test UnstructuredIngestError with None status_code"
471471 in invoke_response .status_code_text
472472 )
473-
474-
475- # Tests for UnstructuredIngestErrorV2
476- @pytest .mark .parametrize (
477- "file_data" , mock_file_data , ids = [type (fd ).__name__ for fd in mock_file_data ]
478- )
479- def test_unstructured_ingest_error_v2_with_status_code (file_data ):
480- """Test that UnstructuredIngestErrorV2 with status_code is handled correctly."""
481- from test .assets .exception_status_code import (
482- function_raises_unstructured_ingest_error_v2_with_status_code as test_fn ,
483- )
484-
485- client = TestClient (wrap_in_fastapi (func = test_fn , plugin_id = "mock_plugin" ))
486-
487- post_body = {"file_data" : file_data .model_dump ()}
488- resp = client .post ("/invoke" , json = post_body )
489- resp_content = resp .json ()
490- invoke_response = InvokeResponse .model_validate (resp_content )
491-
492- # Should use the UnstructuredIngestErrorV2's status_code
493- assert invoke_response .status_code == 400
494- assert "Test UnstructuredIngestErrorV2 with status_code" in invoke_response .status_code_text
495-
496-
497- @pytest .mark .parametrize (
498- "file_data" , mock_file_data , ids = [type (fd ).__name__ for fd in mock_file_data ]
499- )
500- def test_unstructured_ingest_error_v2_without_status_code (file_data ):
501- """Test that UnstructuredIngestErrorV2 without status_code defaults to 500."""
502- from test .assets .exception_status_code import (
503- function_raises_unstructured_ingest_error_v2_without_status_code as test_fn ,
504- )
505-
506- client = TestClient (wrap_in_fastapi (func = test_fn , plugin_id = "mock_plugin" ))
507-
508- post_body = {"file_data" : file_data .model_dump ()}
509- resp = client .post ("/invoke" , json = post_body )
510- resp_content = resp .json ()
511- invoke_response = InvokeResponse .model_validate (resp_content )
512-
513- # Should default to 500 when UnstructuredIngestErrorV2 has no status_code
514- assert invoke_response .status_code == 500
515- assert "Test UnstructuredIngestErrorV2 without status_code" in invoke_response .status_code_text
516-
517-
518- @pytest .mark .parametrize (
519- "file_data" , mock_file_data , ids = [type (fd ).__name__ for fd in mock_file_data ]
520- )
521- def test_async_unstructured_ingest_error_v2 (file_data ):
522- """Test that async functions with UnstructuredIngestErrorV2 are handled correctly."""
523- from test .assets .exception_status_code import (
524- async_function_raises_unstructured_ingest_error_v2 as test_fn ,
525- )
526-
527- client = TestClient (wrap_in_fastapi (func = test_fn , plugin_id = "mock_plugin" ))
528-
529- post_body = {"file_data" : file_data .model_dump ()}
530- resp = client .post ("/invoke" , json = post_body )
531- resp_content = resp .json ()
532- invoke_response = InvokeResponse .model_validate (resp_content )
533-
534- # Should use the UnstructuredIngestErrorV2's status_code
535- assert invoke_response .status_code == 503
536- assert "Async test UnstructuredIngestErrorV2" in invoke_response .status_code_text
0 commit comments