Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 302 for AyTest (0.11 sec)

  1. tests/test_ambiguous_params.py

    import pytest
    from fastapi import Depends, FastAPI, Path
    from fastapi.param_functions import Query
    from fastapi.testclient import TestClient
    from fastapi.utils import PYDANTIC_V2
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    def test_no_annotated_defaults():
        with pytest.raises(
            AssertionError, match="Path parameters cannot have a default value"
        ):
    
            @app.get("/items/{item_id}/")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Dec 12 00:22:47 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  2. platforms/ide/tooling-api/src/crossVersionTest/groovy/org/gradle/integtests/tooling/r27/TestLauncherCrossVersionSpec.groovy

                launcher.withJvmTestClasses("example.MyTest")
                launcher.withJvmTestMethods("example.MyTest", "foo")
            }
    
            then:
            assertTestExecuted(className: "example.MyTest", methodName: "foo", task: ":test")
            assertTestExecuted(className: "example.MyTest", methodName: "foo", task: ":secondTest")
            assertTestExecuted(className: "example.MyTest", methodName: "foo2", task: ":secondTest")
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu May 16 10:10:39 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  3. tests/test_invalid_path_param.py

    import pytest
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    def test_invalid_sequence():
        with pytest.raises(AssertionError):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/{id}")
            def read_items(id: List[Item]):
                pass  # pragma: no cover
    
    
    def test_invalid_tuple():
        with pytest.raises(AssertionError):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Mon Jun 03 17:59:40 UTC 2019
    - 1.7K bytes
    - Viewed (0)
  4. platforms/ide/tooling-api/src/crossVersionTest/groovy/org/gradle/integtests/tooling/r82/TestLauncherTestSpecCrossVersionSpec.groovy

                }
            }
    
            then:
            // 1 test class + 2 test method events
            stdout.toString().contains("Reusing configuration cache.")
            events.testClassesAndMethods.size() == 3
            assertTestExecuted(className: 'example.MyTest', methodName: 'foo', task: ':secondTest')
            assertTestExecuted(className: 'example.MyTest', methodName: 'foo2', task: ':secondTest')
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue Sep 26 14:49:20 UTC 2023
    - 5.4K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_websockets/test_tutorial002_an_py39.py

        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    @needs_py39
    def test_websocket_invalid_data(app: FastAPI):
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  6. tests/test_invalid_sequence_param.py

    from typing import Dict, List, Optional, Tuple
    
    import pytest
    from fastapi import FastAPI, Query
    from pydantic import BaseModel
    
    
    def test_invalid_sequence():
        with pytest.raises(AssertionError):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/")
            def read_items(q: List[Item] = Query(default=None)):
                pass  # pragma: no cover
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_websockets/test_tutorial002_py310.py

        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    @needs_py310
    def test_websocket_invalid_data(app: FastAPI):
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_websockets/test_tutorial002.py

    def test_websocket_no_credentials():
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    def test_websocket_invalid_data():
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sun Nov 13 14:26:09 UTC 2022
    - 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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  10. 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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 2K bytes
    - Viewed (0)
Back to top