Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for get_model (0.15 sec)

  1. tests/test_datetime_custom_encoder.py

        app = FastAPI()
        model = ModelWithDatetimeField(dt_field=datetime(2019, 1, 1, 8))
    
        @app.get("/model", response_model=ModelWithDatetimeField)
        def get_model():
            return model
    
        client = TestClient(app)
        with client:
            response = client.get("/model")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 817 bytes
    - Viewed (0)
  2. docs_src/path_params/tutorial005_py39.py

    from fastapi import FastAPI
    
    
    class ModelName(str, Enum):
        alexnet = "alexnet"
        resnet = "resnet"
        lenet = "lenet"
    
    
    app = FastAPI()
    
    
    @app.get("/models/{model_name}")
    async def get_model(model_name: ModelName):
        if model_name is ModelName.alexnet:
            return {"model_name": model_name, "message": "Deep Learning FTW!"}
    
        if model_name.value == "lenet":
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 546 bytes
    - Viewed (0)
  3. tests/test_filter_pydantic_sub_model_pv2.py

                    raise ValueError("name must end in A")
                return name
    
        async def get_model_c() -> ModelC:
            return ModelC(username="test-user", password="test-password")
    
        @app.get("/model/{name}", response_model=ModelA)
        async def get_model_a(name: str, model_c=Depends(get_model_c)):
            return {
                "name": name,
                "description": "model-a-desc",
                "foo": model_c,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_python_types/test_tutorial008b.py

    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="module",
        params=[
            pytest.param("tutorial008b_py39"),
            pytest.param("tutorial008b_py310", marks=needs_py310),
        ],
    )
    def get_module(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.python_types.{request.param}")
        return mod
    
    
    def test_process_items(module: ModuleType):
        with patch("builtins.print") as mock_print:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 637 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_websockets/test_tutorial003.py

    import importlib
    from types import ModuleType
    
    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="mod",
        params=[
            pytest.param("tutorial003_py39"),
        ],
    )
    def get_mod(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.websockets.{request.param}")
    
        return mod
    
    
    @pytest.fixture(name="html")
    def get_html(mod: ModuleType):
        return mod.html
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_dependencies/test_tutorial008c.py

    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="mod",
        params=[
            pytest.param("tutorial008c_py39"),
            pytest.param("tutorial008c_an_py39"),
        ],
    )
    def get_mod(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.dependencies.{request.param}")
    
        return mod
    
    
    def test_get_no_item(mod: ModuleType):
        client = TestClient(mod.app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_dependencies/test_tutorial008.py

    @pytest.fixture(
        name="module",
        params=[
            "tutorial008_py39",
            # Fails with `NameError: name 'DepA' is not defined`
            pytest.param("tutorial008_an_py39", marks=pytest.mark.xfail),
        ],
    )
    def get_module(request: pytest.FixtureRequest):
        mod_name = f"docs_src.dependencies.{request.param}"
        mod = importlib.import_module(mod_name)
        return mod
    
    
    def test_get_db(module: ModuleType):
        app = FastAPI()
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_dependencies/test_tutorial008d.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="mod",
        params=[
            pytest.param("tutorial008d_py39"),
            pytest.param("tutorial008d_an_py39"),
        ],
    )
    def get_mod(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.dependencies.{request.param}")
    
        return mod
    
    
    def test_get_no_item(mod: ModuleType):
        client = TestClient(mod.app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_python_types/test_tutorial009_tutorial009b.py

    @pytest.fixture(
        name="module",
        params=[
            pytest.param("tutorial009_py39"),
            pytest.param("tutorial009_py310", marks=needs_py310),
            pytest.param("tutorial009b_py39"),
        ],
    )
    def get_module(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.python_types.{request.param}")
        return mod
    
    
    def test_say_hi(module: ModuleType):
        with patch("builtins.print") as mock_print:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 805 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_python_types/test_tutorial009c.py

    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="module",
        params=[
            pytest.param("tutorial009c_py39"),
            pytest.param("tutorial009c_py310", marks=needs_py310),
        ],
    )
    def get_module(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.python_types.{request.param}")
        return mod
    
    
    def test_say_hi(module: ModuleType):
        with patch("builtins.print") as mock_print:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 777 bytes
    - Viewed (0)
Back to top