- Sort Score
- Result 10 results
- Languages All
Results 61 - 70 of 780 for fdef (0.98 sec)
-
docs/de/docs/async.md
```Python hl_lines="1" async def get_burgers(number: int): # Mache hier etwas Asynchrones, um die Burger zu erstellen return burgers ``` ... statt mit `def`: ```Python hl_lines="2" # Dies ist nicht asynchron def get_sequential_burgers(number: int):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Sep 20 15:10:09 UTC 2025 - 27.9K bytes - Viewed (0) -
tests/test_tutorial/test_security/test_tutorial005.py
def test_verify_password(mod: ModuleType): assert mod.verify_password( "secret", mod.fake_users_db["johndoe"]["hashed_password"] ) def test_get_password_hash(mod: ModuleType): assert mod.get_password_hash("secretalice") def test_create_access_token(mod: ModuleType): access_token = mod.create_access_token(data={"data": "foo"}) assert access_token
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 15.8K bytes - Viewed (0) -
tests/test_security_api_key_cookie_description.py
class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: User = Depends(get_current_user)): return current_user def test_security_api_key(): client = TestClient(app, cookies={"key": "secret"})
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 24 19:03:06 UTC 2025 - 2.1K bytes - Viewed (0) -
tests/test_security_http_bearer_optional.py
security = HTTPBearer(auto_error=False) @app.get("/users/me") def read_current_user( credentials: Optional[HTTPAuthorizationCredentials] = Security(security), ): if credentials is None: return {"msg": "Create an account first"} return {"scheme": credentials.scheme, "credentials": credentials.credentials} client = TestClient(app) def test_security_http_bearer():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.1K bytes - Viewed (0) -
tests/test_security_oauth2_authorization_code_bearer_description.py
auto_error=True, ) @app.get("/items/") async def read_items(token: Optional[str] = Security(oauth2_scheme)): return {"token": token} client = TestClient(app) def test_no_token(): response = client.get("/items") assert response.status_code == 401, response.text assert response.json() == {"detail": "Not authenticated"} def test_incorrect_token():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.4K bytes - Viewed (0) -
tests/test_security_oauth2_password_bearer_optional.py
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/token", auto_error=False) @app.get("/items/") async def read_items(token: Optional[str] = Security(oauth2_scheme)): if token is None: return {"msg": "Create an account first"} return {"token": token} client = TestClient(app) def test_no_token(): response = client.get("/items") assert response.status_code == 200, response.text
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.1K bytes - Viewed (0) -
tests/test_tutorial/test_query_params_str_validations/test_tutorial003.py
pytest.param("tutorial003_an_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module( f"docs_src.query_params_str_validations.{request.param}" ) client = TestClient(mod.app) return client def test_query_params_str_validations_no_query(client: TestClient): response = client.get("/items/")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 5.1K bytes - Viewed (0) -
tests/test_union_forms.py
email: str class CompanyForm(BaseModel): company_name: str industry: str @app.post("/form-union/") def post_union_form(data: Annotated[Union[UserForm, CompanyForm], Form()]): return {"received": data} client = TestClient(app) def test_post_user_form(): response = client.post( "/form-union/", data={"name": "John Doe", "email": "******@****.***"} )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 5.2K bytes - Viewed (0) -
tests/test_dependency_cache.py
counter_holder = {"counter": 0} async def dep_counter(): counter_holder["counter"] += 1 return counter_holder["counter"] async def super_dep(count: int = Depends(dep_counter)): return count @app.get("/counter/") async def get_counter(count: int = Depends(dep_counter)): return {"counter": count} @app.get("/sub-counter/") async def get_sub_counter(Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Aug 23 13:30:24 UTC 2022 - 2.7K bytes - Viewed (0) -
tests/test_security_scopes_sub_dependency.py
from fastapi.testclient import TestClient @pytest.fixture(name="call_counts") def call_counts_fixture(): return { "get_db_session": 0, "get_current_user": 0, "get_user_me": 0, "get_user_items": 0, } @pytest.fixture(name="app") def app_fixture(call_counts: dict[str, int]): def get_db_session(): call_counts["get_db_session"] += 1
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 2.9K bytes - Viewed (0)