Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 15 of 15 for last_query (0.07 sec)

  1. docs/zh/docs/tutorial/dependencies/sub-dependencies.md

    {* ../../docs_src/dependencies/tutorial005.py hl[13] *}
    
    这里重点说明一下声明的参数:
    
    * 尽管该函数自身是依赖项,但还声明了另一个依赖项(它「依赖」于其他对象)
        * 该函数依赖 `query_extractor`, 并把 `query_extractor` 的返回值赋给参数 `q`
    * 同时,该函数还声明了类型是 `str` 的可选 cookie(`last_query`)
        * 用户未提供查询参数 `q` 时,则使用上次使用后保存在 cookie 中的查询
    
    ### 使用依赖项
    
    接下来,就可以使用依赖项:
    
    {* ../../docs_src/dependencies/tutorial005.py hl[22] *}
    
    /// info | 信息
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  2. docs/ja/docs/tutorial/dependencies/sub-dependencies.md

    {* ../../docs_src/dependencies/tutorial005.py hl[13] *}
    
    宣言されたパラメータに注目してみましょう:
    
    * この関数は依存関係(「依存可能なもの」)そのものであるにもかかわらず、別の依存関係を宣言しています(何か他のものに「依存」しています)。
        * これは`query_extractor`に依存しており、それが返す値をパラメータ`q`に代入します。
    * また、オプショナルの`last_query`クッキーを`str`として宣言します。
        * ユーザーがクエリ`q`を提供しなかった場合、クッキーに保存していた最後に使用したクエリを使用します。
    
    ### 依存関係の使用
    
    以下のように依存関係を使用することができます:
    
    {* ../../docs_src/dependencies/tutorial005.py hl[21] *}
    
    /// info | 情報
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  3. 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)
  4. tests/test_repeated_parameter_alias.py

    
    client = TestClient(app)
    
    
    def test_get_parameters():
        response = client.get("/test_path", params={"repeated_alias": "test_query"})
        assert response.status_code == 200, response.text
        assert response.json() == {"path": "test_path", "query": "test_query"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == status.HTTP_200_OK
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.7K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_graphql/test_tutorial001.py

        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):
        response = client.post("/graphql", json={"query": "{ user { name, age } }"})
        assert response.status_code == 200
        assert response.json() == {"data": {"user": {"name": "Patrick", "age": 100}}}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 2.2K bytes
    - Viewed (0)
Back to top