Search Options

Results per page
Sort
Preferred Languages
Advance

Results 241 - 250 of 601 for pytest (0.03 sec)

  1. tests/test_dependency_partial.py

    from collections.abc import AsyncGenerator, Generator
    from functools import partial
    from typing import Annotated
    
    import pytest
    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    def function_dependency(value: str) -> str:
        return value
    
    
    async def async_function_dependency(value: str) -> str:
        return value
    
    
    def gen_dependency(value: str) -> Generator[str, None, None]:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 6.3K bytes
    - Viewed (0)
  2. docs/pt/docs/project-generation.md

    - 🐋 [Docker Compose](https://www.docker.com) para desenvolvimento e produção.
    - 🔒 _Hash_ seguro de senhas por padrão.
    - 🔑 Autenticação por token JWT.
    - 📫 Recuperação de senhas baseada em email.
    - ✅ Testes com [Pytest](https://pytest.org).
    - 📞 [Traefik](https://traefik.io) como proxy reverso / balanceador de carga.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 10:17:03 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_graphql/test_tutorial001.py

    import warnings
    
    import pytest
    from starlette.testclient import TestClient
    
    warnings.filterwarnings(
        "ignore",
        message=r"The 'lia' package has been renamed to 'cross_web'\..*",
        category=DeprecationWarning,
    )
    
    from docs_src.graphql_.tutorial001_py39 import app  # noqa: E402
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        return TestClient(app)
    
    
    def test_query(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py

    import pytest
    from fastapi.testclient import TestClient
    
    from docs_src.path_operation_configuration.tutorial006_py39 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/items/", 200, [{"name": "Foo", "price": 42}]),
            ("/users/", 200, [{"username": "johndoe"}]),
            ("/elements/", 200, [{"item_id": "Foo"}]),
        ],
    )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 2.4K bytes
    - Viewed (0)
  5. scripts/test.sh

    #!/usr/bin/env bash
    
    set -e
    set -x
    
    export PYTHONPATH=./docs_src
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Jun 11 21:38:15 UTC 2023
    - 99 bytes
    - Viewed (0)
  6. tests/test_dependency_after_yield_raise.py

    from typing import Annotated, Any
    
    import pytest
    from fastapi import Depends, FastAPI, HTTPException
    from fastapi.testclient import TestClient
    
    
    class CustomError(Exception):
        pass
    
    
    def catching_dep() -> Any:
        try:
            yield "s"
        except CustomError as err:
            raise HTTPException(status_code=418, detail="Session error") from err
    
    
    def broken_dep() -> Any:
        yield "s"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  7. tests/test_dependency_yield_except_httpexception.py

    import pytest
    from fastapi import Body, Depends, FastAPI, HTTPException
    from fastapi.testclient import TestClient
    
    initial_fake_database = {"rick": "Rick Sanchez"}
    
    fake_database = initial_fake_database.copy()
    
    initial_state = {"except": False, "finally": False}
    
    state = initial_state.copy()
    
    app = FastAPI()
    
    
    async def get_database():
        temp_database = fake_database.copy()
        try:
            yield temp_database
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 1.9K bytes
    - Viewed (0)
  8. docs/ko/docs/advanced/async-tests.md

    {* ../../docs_src/async_tests/test_main.py *}
    
    ## 실행하기
    
    아래의 명령어로 테스트 코드를 실행합니다:
    
    <div class="termy">
    
    ```console
    $ pytest
    
    ---> 100%
    ```
    
    </div>
    
    ## 자세히 보기
    
    `@pytest.mark.anyio` 마커는 pytest에게 이 테스트 함수가 비동기로 호출되어야 함을 알려줍니다:
    
    {* ../../docs_src/async_tests/test_main.py hl[7] *}
    
    /// tip | 팁
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 10 11:03:16 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  9. tests/test_union_body_discriminator_annotated.py

    # Ref: https://github.com/fastapi/fastapi/discussions/14495
    
    from typing import Annotated, Union
    
    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from pydantic import BaseModel
    
    
    @pytest.fixture(name="client")
    def client_fixture() -> TestClient:
        from fastapi import Body
        from pydantic import Discriminator, Tag
    
        class Cat(BaseModel):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 7.7K bytes
    - Viewed (0)
  10. tests/test_arbitrary_types.py

    from typing import Annotated
    
    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    
    @pytest.fixture(name="client")
    def get_client():
        from pydantic import (
            BaseModel,
            ConfigDict,
            PlainSerializer,
            TypeAdapter,
            WithJsonSchema,
        )
    
        class FakeNumpyArray:
            def __init__(self):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 3.8K bytes
    - Viewed (0)
Back to top