Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 71 for testclient (0.05 sec)

  1. tests/test_tutorial/test_body/test_tutorial001.py

    import importlib
    from unittest.mock import patch
    
    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            "tutorial001_py39",
            pytest.param("tutorial001_py310", marks=needs_py310),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.body.{request.param}")
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.6K bytes
    - Viewed (0)
  2. tests/benchmarks/test_general_performance.py

    ):
        return ItemOut(name="foo", value=123, dep=dep)
    
    
    @pytest.fixture(scope="module")
    def client() -> Iterator[TestClient]:
        with TestClient(app) as client:
            yield client
    
    
    def _bench_get(benchmark, client: TestClient, path: str) -> tuple[int, bytes]:
        warmup = client.get(path)
        assert warmup.status_code == 200
    
        def do_request() -> tuple[int, bytes]:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 20:40:26 UTC 2025
    - 11.1K bytes
    - Viewed (0)
  3. tests/test_request_params/test_query/test_list.py

    from typing import Annotated
    
    import pytest
    from dirty_equals import IsOneOf
    from fastapi import FastAPI, Query
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/required-list-str")
    async def read_required_list_str(p: Annotated[list[str], Query()]):
        return {"p": p}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 10.9K bytes
    - Viewed (0)
  4. docs/ru/docs/tutorial/testing.md

    Это позволяет вам использовать `pytest` без лишних усложнений.
    
    ///
    
    /// note | Технические детали
    
    Также можно написать `from starlette.testclient import TestClient`.
    
    **FastAPI** предоставляет тот же самый `starlette.testclient` как `fastapi.testclient`. Это всего лишь небольшое удобство для Вас, как разработчика. Но он берётся напрямую из Starlette.
    
    ///
    
    /// tip | Подсказка
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 10K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_body_multiple_params/test_tutorial002.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial002_py39"),
            pytest.param("tutorial002_py310", marks=needs_py310),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.body_multiple_params.{request.param}")
    
        client = TestClient(mod.app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 11K bytes
    - Viewed (0)
  6. fess-crawler/src/test/java/org/codelibs/fess/crawler/client/FaultTolerantClientTest.java

            assertEquals(2, testClient.count);
        }
    
        public void test_doGet_with4Exception_interval100() {
            final FaultTolerantClient client = new FaultTolerantClient();
            client.setRetryInterval(100);
            final TestClient testClient = new TestClient();
            testClient.exceptionCount = 4;
            testClient.interval = 100;
    Registered: Sat Dec 20 11:21:39 UTC 2025
    - Last Modified: Sat Mar 15 06:52:00 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  7. tests/test_request_params/test_form/test_optional_list.py

    from typing import Annotated, Optional
    
    import pytest
    from fastapi import FastAPI, Form
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-list-str", operation_id="optional_list_str")
    async def read_optional_list_str(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9.9K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_bigger_applications/test_main.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            "app_py39.main",
            "app_an_py39.main",
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.bigger_applications.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_users_token_jessica(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 21.3K bytes
    - Viewed (0)
  9. tests/test_request_params/test_query/test_required_str.py

    from typing import Annotated
    
    import pytest
    from dirty_equals import IsOneOf
    from fastapi import FastAPI, Query
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/required-str")
    async def read_required_str(p: str):
        return {"p": p}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9.9K bytes
    - Viewed (0)
  10. tests/test_request_params/test_body/test_optional_list.py

    from typing import Annotated, Optional
    
    import pytest
    from fastapi import Body, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-list-str", operation_id="optional_list_str")
    async def read_optional_list_str(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 12.7K bytes
    - Viewed (0)
Back to top