Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for mod_name (0.04 sec)

  1. tests/test_tutorial/test_debugging/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    MOD_NAME = "docs_src.debugging.tutorial001_py39"
    
    
    @pytest.fixture(name="client")
    def get_client():
        mod = importlib.import_module(MOD_NAME)
        client = TestClient(mod.app)
        return client
    
    
    def test_uvicorn_run_is_not_called_on_import():
        if sys.modules.get(MOD_NAME):
            del sys.modules[MOD_NAME]  # pragma: no cover
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_settings/test_app01.py

        main_mod = importlib.import_module(mod_name)
        return TestClient(main_mod.app)
    
    
    def test_settings_validation_error(mod_name: str, monkeypatch: MonkeyPatch):
        monkeypatch.delenv("ADMIN_EMAIL", raising=False)
        if mod_name in sys.modules:
            del sys.modules[mod_name]  # pragma: no cover
    
        with pytest.raises(ValidationError) as exc_info:
            importlib.import_module(mod_name)
        assert exc_info.value.errors() == [
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py

            "description": "Item description",
            "price": 42.0,
            "tax": 3.2,
            "tags": IsList("bar", "baz", check_order=False),
        }
    
    
    def test_openapi_schema(client: TestClient, mod_name: str):
        mod_name = mod_name[:11]
    
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_body_nested_models/test_tutorial001_tutorial002_tutorial003.py

        return request.param
    
    
    @pytest.fixture(name="client")
    def get_client(mod_name: str):
        mod = importlib.import_module(f"docs_src.body_nested_models.{mod_name}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_put_all(client: TestClient, mod_name: str):
        if mod_name.startswith("tutorial003"):
            tags_expected = IsList("foo", "bar", check_order=False)
        else:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7.9K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_custom_response/test_tutorial002_tutorial003_tutorial004.py

    
    @pytest.fixture(
        name="mod_name",
        params=[
            pytest.param("tutorial002_py39"),
            pytest.param("tutorial003_py39"),
            pytest.param("tutorial004_py39"),
        ],
    )
    def get_mod_name(request: pytest.FixtureRequest) -> str:
        return request.param
    
    
    @pytest.fixture(name="client")
    def get_client(mod_name: str) -> TestClient:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_dependencies/test_tutorial008.py

            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()
    
        @app.get("/")
        def read_root(c: Annotated[Any, Depends(module.dependency_c)]):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_path_params/test_tutorial005.py

        response = client.get("/models/alexnet")
        assert response.status_code == 200
        assert response.json() == {"model_name": "alexnet", "message": "Deep Learning FTW!"}
    
    
    def test_get_enums_lenet():
        response = client.get("/models/lenet")
        assert response.status_code == 200
        assert response.json() == {"model_name": "lenet", "message": "LeCNN all the images"}
    
    
    def test_get_enums_resnet():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 4.1K bytes
    - Viewed (0)
  8. fastapi/_compat/v2.py

            if model not in model_name_map or "$ref" not in schema:
                continue
            new_name = model_name_map[model]
            old_name = schema["$ref"].split("/")[-1]
            if old_name in {f"{new_name}-Input", f"{new_name}-Output"}:
                continue
            old_name_to_new_name_map[old_name] = new_name
    
        new_field_mapping: dict[
            tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue
        ] = {}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  9. fastapi/dependencies/utils.py

            return None
        first_param = flat_dependant.body_params[0]
        if not embed_body_fields:
            return first_param
        model_name = "Body_" + name
        BodyModel = create_body_model(
            fields=flat_dependant.body_params, model_name=model_name
        )
        required = any(True for f in flat_dependant.body_params if f.required)
        BodyFieldInfo_kwargs: dict[str, Any] = {
            "annotation": BodyModel,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 37.6K bytes
    - Viewed (3)
Back to top