Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for test_no_annotated_defaults (0.09 sec)

  1. tests/test_ambiguous_params.py

    from typing import Annotated
    
    import pytest
    from fastapi import Depends, FastAPI, Path
    from fastapi.param_functions import Query
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    def test_no_annotated_defaults():
        with pytest.raises(
            AssertionError, match="Path parameters cannot have a default value"
        ):
    
            @app.get("/items/{item_id}/")
            async def get_item(item_id: Annotated[int, Path(default=1)]):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 2K bytes
    - Viewed (1)
Back to top