Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for 26 (0.17 sec)

  1. docs/zh/docs/advanced/testing-dependencies.md

    ### 使用 `app.dependency_overrides` 属性
    
    对于这些用例,**FastAPI** 应用支持 `app.dependcy_overrides` 属性,该属性就是**字典**。
    
    要在测试时覆盖原有依赖项,这个字典的键应当是原依赖项(函数),值是覆盖依赖项(另一个函数)。
    
    这样一来,**FastAPI** 就会调用覆盖依赖项,不再调用原依赖项。
    
    ```Python hl_lines="26-27  30"
    {!../../../docs_src/dependency_testing/tutorial001.py!}
    ```
    
    !!! tip "提示"
    
        **FastAPI** 应用中的任何位置都可以实现覆盖依赖项。
    
        原依赖项可用于*路径操作函数*、*路径操作装饰器*(不需要返回值时)、`.include_router()` 调用等。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 22:45:53 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  2. docs/de/docs/advanced/testing-dependencies.md

    Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abhängigkeit auf.
    
    === "Python 3.10+"
    
        ```Python hl_lines="26-27  30"
        {!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!}
        ```
    
    === "Python 3.9+"
    
        ```Python hl_lines="28-29  32"
        {!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!}
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:17:32 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/testing-dependencies.md

    And then **FastAPI** will call that override instead of the original dependency.
    
    === "Python 3.10+"
    
        ```Python hl_lines="26-27  30"
        {!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!}
        ```
    
    === "Python 3.9+"
    
        ```Python hl_lines="28-29  32"
        {!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!}
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.9K bytes
    - Viewed (0)
Back to top