Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 294 for ptrtest (0.25 sec)

  1. tests/test_tutorial/test_response_model/test_tutorial003_04_py310.py

    import pytest
    from fastapi.exceptions import FastAPIError
    
    from ...utils import needs_py310
    
    
    @needs_py310
    def test_invalid_response_model():
        with pytest.raises(FastAPIError):
            from docs_src.response_model.tutorial003_04_py310 import app
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Jan 10 16:22:47 UTC 2023
    - 289 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_dependencies/test_tutorial008d_an.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008d_an import app
    
        client = TestClient(app)
        return client
    
    
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
        assert response.json() == {"detail": "Item not found, there's only a plumbus here"}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_dependencies/test_tutorial004_an_py310.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial004_an_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            (
                "/items",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  4. docs/em/docs/tutorial/testing.md

    ///
    
    ## 🏃 ⚫️
    
    ⏮️ 👈, 👆 💪 ❎ `pytest`:
    
    <div class="termy">
    
    ```console
    $ pip install pytest
    
    ---> 100%
    ```
    
    </div>
    
    ⚫️ 🔜 🔍 📁 &amp; 💯 🔁, 🛠️ 👫, &amp; 📄 🏁 🔙 👆.
    
    🏃 💯 ⏮️:
    
    <div class="termy">
    
    ```console
    $ pytest
    
    ================ test session starts ================
    platform linux -- Python 3.6.9, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.1K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_dependencies/test_tutorial004_an_py39.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial004_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            (
                "/items",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_additional_status_codes/test_tutorial001_an_py310.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.additional_status_codes.tutorial001_an_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_update(client: TestClient):
        response = client.put("/items/foo", json={"name": "Wrestlers"})
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 741 bytes
    - Viewed (0)
  7. docs/pt/docs/advanced/async-tests.md

    {!../../docs_src/async_tests/test_main.py!}
    ```
    
    ## Executá-lo
    
    Você pode executar os seus testes normalmente via:
    
    <div class="termy">
    
    ```console
    $ pytest
    
    ---> 100%
    ```
    
    </div>
    
    ## Em Detalhes
    
    O marcador `@pytest.mark.anyio` informa ao pytest que esta função de teste deve ser invocada de maneira assíncrona:
    
    ```Python hl_lines="7"
    {!../../docs_src/async_tests/test_main.py!}
    ```
    
    /// tip | "Dica"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  8. docs/de/docs/tutorial/testing.md

    ## Tests ausführen
    
    Danach müssen Sie nur noch `pytest` installieren:
    
    <div class="termy">
    
    ```console
    $ pip install pytest
    
    ---> 100%
    ```
    
    </div>
    
    Es erkennt die Dateien und Tests automatisch, führt sie aus und berichtet Ihnen die Ergebnisse.
    
    Führen Sie die Tests aus, mit:
    
    <div class="termy">
    
    ```console
    $ pytest
    
    ================ test session starts ================
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.9K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_dependencies/test_tutorial008b_an_py39.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008b_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 918 bytes
    - Viewed (0)
  10. tests/test_datastructures.py

    from typing import List
    
    import pytest
    from fastapi import FastAPI, UploadFile
    from fastapi.datastructures import Default
    from fastapi.testclient import TestClient
    
    
    # TODO: remove when deprecating Pydantic v1
    def test_upload_file_invalid():
        with pytest.raises(ValueError):
            UploadFile.validate("not a Starlette UploadFile")
    
    
    def test_upload_file_invalid_pydantic_v2():
        with pytest.raises(ValueError):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 2K bytes
    - Viewed (0)
Back to top