Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 294 for ptrtest (0.07 sec)

  1. tests/test_validate_response.py

            {"name": "baz", "price": "baz"},
        ]
    
    
    client = TestClient(app)
    
    
    def test_invalid():
        with pytest.raises(ResponseValidationError):
            client.get("/items/invalid")
    
    
    def test_invalid_none():
        with pytest.raises(ResponseValidationError):
            client.get("/items/invalidnone")
    
    
    def test_valid_none_data():
        response = client.get("/items/validnone")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 2K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_sql_databases/test_tutorial001.py

        default_registry.dispose()
    
    
    @pytest.fixture(
        name="client",
        params=[
            "tutorial001",
            pytest.param("tutorial001_py39", marks=needs_py39),
            pytest.param("tutorial001_py310", marks=needs_py310),
            "tutorial001_an",
            pytest.param("tutorial001_an_py39", marks=needs_py39),
            pytest.param("tutorial001_an_py310", marks=needs_py310),
        ],
    )
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 14.8K bytes
    - Viewed (0)
  3. tests/test_response_model_invalid.py

    from typing import List
    
    import pytest
    from fastapi import FastAPI
    from fastapi.exceptions import FastAPIError
    
    
    class NonPydanticModel:
        pass
    
    
    def test_invalid_response_model_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", response_model=NonPydanticModel)
            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_sub_type_raises():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 29 13:04:35 UTC 2020
    - 1.1K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_dependencies/test_tutorial008d_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.tutorial008d_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
    - 1.3K bytes
    - Viewed (0)
  5. tests/test_dependency_contextmanager.py

        assert state["/async_raise"] == "asyncgen raise not started"
        with pytest.raises(OtherDependencyError):
            client.get("/async_raise_other")
        assert state["/async_raise"] == "asyncgen raise finalized"
        assert "/async_raise" not in errors
    
    
    def test_sync_raise_other():
        assert state["/sync_raise"] == "generator raise not started"
        with pytest.raises(OtherDependencyError):
            client.get("/sync_raise_other")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:13:50 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  6. tests/test_validate_response_dataclass.py

        ]
    
    
    client = TestClient(app)
    
    
    def test_invalid():
        with pytest.raises(ResponseValidationError):
            client.get("/items/invalid")
    
    
    def test_double_invalid():
        with pytest.raises(ResponseValidationError):
            client.get("/items/innerinvalid")
    
    
    def test_invalid_list():
        with pytest.raises(ResponseValidationError):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 1.2K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_websockets/test_tutorial003_py39.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="app")
    def get_app():
        from docs_src.websockets.tutorial003_py39 import app
    
        return app
    
    
    @pytest.fixture(name="html")
    def get_html():
        from docs_src.websockets.tutorial003_py39 import html
    
        return html
    
    
    @pytest.fixture(name="client")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 1.3K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_events/test_tutorial001.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="app", scope="module")
    def get_app():
        with pytest.warns(DeprecationWarning):
            from docs_src.events.tutorial001 import app
        yield app
    
    
    def test_events(app: FastAPI):
        with TestClient(app) as client:
            response = client.get("/items/foo")
            assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_dependencies/test_tutorial008c_an_py39.py

    import pytest
    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008c_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/testing.md

    ///
    
    ## 运行起来
    
    之后,你只需要安装 `pytest`:
    
    <div class="termy">
    
    ```console
    $ pip install pytest
    
    ---> 100%
    ```
    
    </div>
    
    他会自动检测文件和测试,执行测试,然后向你报告结果。
    
    执行测试:
    
    <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
    - 6K bytes
    - Viewed (0)
Back to top