- Sort Score
- Result 10 results
- Languages All
Results 441 - 450 of 518 for testclient (0.07 sec)
-
docs/pt/docs/advanced/testing-events.md
# Testando eventos: lifespan e inicialização - encerramento { #testing-events-lifespan-and-startup-shutdown } Quando você precisa que o `lifespan` seja executado em seus testes, você pode utilizar o `TestClient` com a instrução `with`: {* ../../docs_src/app_testing/tutorial004_py39.py hl[9:15,18,27:28,30:32,41:43] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 685 bytes - Viewed (0) -
docs/zh/docs/advanced/testing-events.md
# 测试事件:启动 - 关闭 使用 `TestClient` 和 `with` 语句,在测试中运行事件处理器(`startup` 与 `shutdown`)。
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 205 bytes - Viewed (0) -
tests/test_sub_callbacks.py
from typing import Optional from fastapi import APIRouter, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, HttpUrl app = FastAPI() class Invoice(BaseModel): id: str title: Optional[str] = None customer: str total: float class InvoiceEvent(BaseModel): description: str paid: bool class InvoiceEventReceived(BaseModel): ok: bool
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 12.9K bytes - Viewed (0) -
tests/test_no_schema_split.py
# https://github.com/fastapi/fastapi/discussions/14177 # Made an issue in: # https://github.com/fastapi/fastapi/issues/14247 from enum import Enum from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, Field class MessageEventType(str, Enum): alpha = "alpha" beta = "beta" class MessageEvent(BaseModel):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 6.4K bytes - Viewed (0) -
tests/test_request_body_parameters_media_type.py
from fastapi import Body, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() media_type = "application/vnd.api+json" # NOTE: These are not valid JSON:API resources # but they are fine for testing requestBody with custom media_type class Product(BaseModel): name: str price: float class Shop(BaseModel): name: str @app.post("/products")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6.3K bytes - Viewed (0) -
tests/test_schema_extra_examples.py
from typing import Union import pytest from fastapi import Body, Cookie, FastAPI, Header, Path, Query from fastapi.exceptions import FastAPIDeprecationWarning from fastapi.testclient import TestClient from pydantic import BaseModel, ConfigDict def create_app(): app = FastAPI() class Item(BaseModel): data: str model_config = ConfigDict(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 32.2K bytes - Viewed (0) -
tests/test_multi_body_errors.py
from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, condecimal app = FastAPI() class Item(BaseModel): name: str age: condecimal(gt=Decimal(0.0)) # type: ignore @app.post("/items/") def save_item_no_body(item: list[Item]): return {"item": item} client = TestClient(app) def test_put_correct_body():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 6.1K bytes - Viewed (0) -
tests/test_query.py
from fastapi.testclient import TestClient from .main import app client = TestClient(app) def test_query(): response = client.get("/query") assert response.status_code == 422 assert response.json() == { "detail": [ { "type": "missing", "loc": ["query", "query"], "msg": "Field required", "input": None, } ]
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.4K bytes - Viewed (0) -
tests/test_dependency_wrapped.py
from collections.abc import AsyncGenerator, Generator from functools import wraps import pytest from fastapi import Depends, FastAPI from fastapi.concurrency import iterate_in_threadpool, run_in_threadpool from fastapi.testclient import TestClient if sys.version_info >= (3, 13): # pragma: no cover from inspect import iscoroutinefunction else: # pragma: no cover from asyncio import iscoroutinefunction def noop_wrap(func):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 11.2K bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_tutorial002.py
import importlib import warnings import pytest from dirty_equals import IsInt from fastapi.testclient import TestClient from inline_snapshot import Is, snapshot from sqlalchemy import StaticPool from sqlmodel import SQLModel, create_engine from sqlmodel.main import default_registry from tests.utils import needs_py310 def clear_sqlmodel(): # Clear the tables in the metadata for the default base model SQLModel.metadata.clear()
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 17.9K bytes - Viewed (0)