Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 2,270 for testify (0.18 sec)

  1. docs/en/docs/advanced/testing-events.md

    # Testing Events: startup - shutdown
    
    When you need your event handlers (`startup` and `shutdown`) to run in your tests, you can use the `TestClient` with a `with` statement:
    
    ```Python hl_lines="9-12  20-24"
    {!../../../docs_src/app_testing/tutorial003.py!}
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 29 14:02:58 GMT 2020
    - 262 bytes
    - Viewed (0)
  2. docs/zh/docs/advanced/testing-dependencies.md

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

    🔐 🔗 🔬, 👆 🚮 🔑 ⏮️ 🔗 (🔢), & 💲, 👆 🔗 🔐 (➕1️⃣ 🔢).
    
    & ⤴️ **FastAPI** 🔜 🤙 👈 🔐 ↩️ ⏮️ 🔗.
    
    ```Python hl_lines="28-29  32"
    {!../../../docs_src/dependency_testing/tutorial001.py!}
    ```
    
    !!! tip
        👆 💪 ⚒ 🔗 🔐 🔗 ⚙️ 🙆 👆 **FastAPI** 🈸.
    
        ⏮️ 🔗 💪 ⚙️ *➡ 🛠️ 🔢*, *➡ 🛠️ 👨‍🎨* (🕐❔ 👆 🚫 ⚙️ 📨 💲), `.include_router()` 🤙, ♒️.
    
        FastAPI 🔜 💪 🔐 ⚫️.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  4. docs/de/docs/advanced/testing-dependencies.md

        ```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!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="29-30  33"
        {!> ../../../docs_src/dependency_testing/tutorial001_an.py!}
        ```
    
    === "Python 3.10+ nicht annotiert"
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:17:32 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  5. docs/em/docs/advanced/testing-database.md

    # 🔬 💽
    
    👆 💪 ⚙️ 🎏 🔗 🔐 ⚪️➡️ [🔬 🔗 ⏮️ 🔐](testing-dependencies.md){.internal-link target=_blank} 📉 💽 🔬.
    
    👆 💪 💚 ⚒ 🆙 🎏 💽 🔬, 💾 💽 ⏮️ 💯, 🏤-🥧 ⚫️ ⏮️ 🔬 💽, ♒️.
    
    👑 💭 ⚫️❔ 🎏 👆 👀 👈 ⏮️ 📃.
    
    ## 🚮 💯 🗄 📱
    
    ➡️ ℹ 🖼 ⚪️➡️ [🗄 (🔗) 💽](../tutorial/sql-databases.md){.internal-link target=_blank} ⚙️ 🔬 💽.
    
    🌐 📱 📟 🎏, 👆 💪 🚶 🔙 👈 📃 ✅ ❔ ⚫️.
    
    🕴 🔀 📥 🆕 🔬 📁.
    
    👆 😐 🔗 `get_db()` 🔜 📨 💽 🎉.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  6. docs/em/docs/advanced/testing-websockets.md

    # 🔬 *️⃣
    
    👆 💪 ⚙️ 🎏 `TestClient` 💯*️⃣.
    
    👉, 👆 ⚙️ `TestClient` `with` 📄, 🔗*️⃣:
    
    ```Python hl_lines="27-31"
    {!../../../docs_src/app_testing/tutorial002.py!}
    ```
    
    !!! note
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 372 bytes
    - Viewed (0)
  7. docs/zh/docs/advanced/testing-events.md

    # 测试事件:启动 - 关闭
    
    使用 `TestClient` 和 `with` 语句,在测试中运行事件处理器(`startup` 与 `shutdown`)。
    
    ```Python hl_lines="9-12  20-24"
    {!../../../docs_src/app_testing/tutorial003.py!}
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jan 28 18:21:02 GMT 2024
    - 228 bytes
    - Viewed (0)
  8. docs/zh/docs/advanced/testing-database.md

    # 测试数据库
    
    您还可以使用[测试依赖项](testing-dependencies.md){.internal-link target=_blank}中的覆盖依赖项方法变更测试的数据库。
    
    实现设置其它测试数据库、在测试后回滚数据、或预填测试数据等操作。
    
    本章的主要思路与上一章完全相同。
    
    ## 为 SQL 应用添加测试
    
    为了使用测试数据库,我们要升级 [SQL 关系型数据库](../tutorial/sql-databases.md){.internal-link target=_blank} 一章中的示例。
    
    应用的所有代码都一样,直接查看那一章的示例代码即可。
    
    本章只是新添加了测试文件。
    
    正常的依赖项 `get_db()` 返回数据库会话。
    
    测试时使用覆盖依赖项返回自定义数据库会话代替正常的依赖项。
    
    本例中,要创建仅用于测试的临时数据库。
    
    ## 文件架构
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jan 28 18:09:26 GMT 2024
    - 2.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_sql_databases/test_testing_databases.py

    import importlib
    import os
    from pathlib import Path
    
    import pytest
    
    from ...utils import needs_pydanticv1
    
    
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_testing_dbs(tmp_path_factory: pytest.TempPathFactory):
        tmp_path = tmp_path_factory.mktemp("data")
        cwd = os.getcwd()
        os.chdir(tmp_path)
        test_db = Path("./test.db")
        if test_db.is_file():  # pragma: nocover
            test_db.unlink()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 788 bytes
    - Viewed (0)
  10. guava-tests/test/com/google/common/primitives/ImmutableIntArrayTest.java

    import com.google.common.collect.ObjectArrays;
    import com.google.common.collect.testing.ListTestSuiteBuilder;
    import com.google.common.collect.testing.SampleElements;
    import com.google.common.collect.testing.TestListGenerator;
    import com.google.common.collect.testing.features.CollectionFeature;
    import com.google.common.collect.testing.features.CollectionSize;
    import com.google.common.testing.EqualsTester;
    import java.util.ArrayList;
    import java.util.Arrays;
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Thu Jun 01 09:32:35 GMT 2023
    - 20.2K bytes
    - Viewed (0)
Back to top