Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for inline (0.16 sec)

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

    ```Python
    Base.metadata.create_all(bind=engine)
    ```
    
    That is normally called in `main.py`, but the line in `main.py` uses the database file `sql_app.db`, and we need to make sure we create `test.db` for the tests.
    
    So we add that line here, with the new file.
    
    ```Python hl_lines="16"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  2. docs/em/docs/advanced/testing-database.md

        🦁 & 🎯 🔛 🎯 🔬 📟, 👥 🖨 ⚫️.
    
    ## ✍ 💽
    
    ↩️ 🔜 👥 🔜 ⚙️ 🆕 💽 🆕 📁, 👥 💪 ⚒ 💭 👥 ✍ 💽 ⏮️:
    
    ```Python
    Base.metadata.create_all(bind=engine)
    ```
    
    👈 🛎 🤙 `main.py`, ✋️ ⏸ `main.py` ⚙️ 💽 📁 `sql_app.db`, & 👥 💪 ⚒ 💭 👥 ✍ `test.db` 💯.
    
    👥 🚮 👈 ⏸ 📥, ⏮️ 🆕 📁.
    
    ```Python hl_lines="16"
    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)
  3. docs/zh/docs/advanced/testing-database.md

    !!! tip "提示"
    
        为减少代码重复,最好把这段代码写成函数,在 `database.py` 与 `tests/test_sql_app.py`中使用。
    
        为了把注意力集中在测试代码上,本例只是复制了这段代码。
    
    ## 创建数据库
    
    因为现在是想在新文件中使用新数据库,所以要使用以下代码创建数据库:
    
    ```Python
    Base.metadata.create_all(bind=engine)
    ```
    
    一般是在 `main.py` 中调用这行代码,但在 `main.py` 里,这行代码用于创建 `sql_app.db`,但是现在要为测试创建 `test.db`。
    
    因此,要在测试代码中添加这行代码创建新的数据库文件。
    
    ```Python hl_lines="16"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    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)
Back to top