Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for CompanyForm (0.05 sec)

  1. tests/test_union_forms.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class UserForm(BaseModel):
        name: str
        email: str
    
    
    class CompanyForm(BaseModel):
        company_name: str
        industry: str
    
    
    @app.post("/form-union/")
    def post_union_form(data: Annotated[Union[UserForm, CompanyForm], Form()]):
        return {"received": data}
    
    
    client = TestClient(app)
    
    
    def test_post_user_form():
        response = client.post(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 5.2K bytes
    - Viewed (0)
Back to top