Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 682 for cover (0.2 seconds)

  1. tests/test_pydantic_v1_error.py

            def endpoint(data: ParamModelV1):  # pragma: no cover
                return data
    
    
    def test_raises_pydantic_v1_model_in_return_type() -> None:
        class ReturnModelV1(BaseModel):
            name: str
    
        app = FastAPI()
    
        with pytest.raises(PydanticV1NotSupportedError):
    
            @app.get("/return")
            def endpoint() -> ReturnModelV1:  # pragma: no cover
                return ReturnModelV1(name="test")
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 2.3K bytes
    - Click Count (0)
  2. tests/test_invalid_sequence_param.py

        ):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/")
            def read_items(q: list[Item] = Query(default=None)):
                pass  # pragma: no cover
    
    
    def test_invalid_tuple():
        with pytest.raises(
            AssertionError,
            match="Query parameter 'q' must be one of the supported types",
        ):
            app = FastAPI()
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 1.5K bytes
    - Click Count (0)
  3. fastapi/dependencies/models.py

    from fastapi.types import DependencyCacheKey
    
    if sys.version_info >= (3, 13):  # pragma: no cover
        from inspect import iscoroutinefunction
    else:  # pragma: no cover
        from asyncio import iscoroutinefunction
    
    
    def _unwrapped_call(call: Callable[..., Any] | None) -> Any:
        if call is None:
            return call  # pragma: no cover
        unwrapped = inspect.unwrap(_impartial(call))
        return unwrapped
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 11 18:41:21 GMT 2026
    - 7.1K bytes
    - Click Count (0)
  4. tests/test_invalid_path_param.py

            def read_items(id: list[Item]):
                pass  # pragma: no cover
    
    
    def test_invalid_tuple():
        with pytest.raises(AssertionError):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/{id}")
            def read_items(id: tuple[Item, Item]):
                pass  # pragma: no cover
    
    
    def test_invalid_dict():
        with pytest.raises(AssertionError):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.6K bytes
    - Click Count (0)
  5. tests/test_openapi_cache_root_path.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_root_path_does_not_persist_across_requests():
        app = FastAPI()
    
        @app.get("/")
        def read_root():  # pragma: no cover
            return {"ok": True}
    
        # Attacker request with a spoofed root_path
        attacker_client = TestClient(app, root_path="/evil-api")
        response1 = attacker_client.get("/openapi.json")
        data1 = response1.json()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 24 09:28:10 GMT 2026
    - 2.3K bytes
    - Click Count (0)
  6. fastapi/_compat/shared.py

    ) -> TypeGuard[type[_T]]:
        try:
            return isinstance(cls, type) and issubclass(cls, class_or_tuple)  # type: ignore[arg-type]
        except TypeError:  # pragma: no cover
            if isinstance(cls, WithArgsTypes):
                return False
            raise  # pragma: no cover
    
    
    def _annotation_is_sequence(annotation: type[Any] | None) -> bool:
        if lenient_issubclass(annotation, (str, bytes)):
            return False
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 11 18:32:12 GMT 2026
    - 6.9K bytes
    - Click Count (0)
  7. tests/test_additional_responses_custom_model_in_callback.py

    
    @callback_router.get(
        "{$callback_url}/callback/", responses={400: {"model": CustomModel}}
    )
    def callback_route():
        pass  # pragma: no cover
    
    
    @app.post("/", callbacks=callback_router.routes)
    def main_route(callback_url: HttpUrl):
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 14:34:02 GMT 2026
    - 5.9K bytes
    - Click Count (0)
  8. tests/test_dependency_after_yield_websockets.py

    @app.websocket("/ws-broken")
    async def websocket_endpoint_broken(websocket: WebSocket, session: BrokenSessionDep):
        await websocket.accept()
        for item in session:
            await websocket.send_text(f"{item}")  # pragma no cover
    
    
    client = TestClient(app)
    
    
    def test_websocket_dependency_after_yield():
        with client.websocket_connect("/ws") as websocket:
            data = websocket.receive_text()
            assert data == "foo"
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 2K bytes
    - Click Count (0)
  9. tests/test_openapi_model_description_trim_on_formfeed.py

    
    class MyModel(BaseModel):
        """
        A model with a form feed character in the title.
        \f
        Text after form feed character.
        """
    
    
    @app.get("/foo")
    def foo(v: MyModel):  # pragma: no cover
        pass
    
    
    client = TestClient(app)
    
    
    def test_openapi():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        openapi_schema = response.json()
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Jun 17 07:46:27 GMT 2025
    - 660 bytes
    - Click Count (0)
  10. tests/test_request_body_parameters_media_type.py

    @app.post("/products")
    async def create_product(data: Product = Body(media_type=media_type, embed=True)):
        pass  # pragma: no cover
    
    
    @app.post("/shops")
    async def create_shop(
        data: Shop = Body(media_type=media_type),
        included: list[Product] = Body(default=[], media_type=media_type),
    ):
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 7.2K bytes
    - Click Count (0)
Back to Top