Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 70 for parametrizar (0.05 sec)

  1. tests/test_modules_same_name_body/test_main.py

    from .app.main import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path", ["/a/compute", "/a/compute/", "/b/compute", "/b/compute/"]
    )
    def test_post(path):
        data = {"a": 2, "b": "foo"}
        response = client.post(path, json=data)
        assert response.status_code == 200, response.text
        assert data == response.json()
    
    
    @pytest.mark.parametrize(
        "path", ["/a/compute", "/a/compute/", "/b/compute", "/b/compute/"]
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Feb 27 14:42:41 UTC 2025
    - 5.5K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py

        @mod.app.get("/check-class")
        async def check_gzip_request(request: Request):
            return {"request_class": type(request).__name__}
    
        client = TestClient(mod.app)
        return client
    
    
    @pytest.mark.parametrize("compress", [True, False])
    def test_gzip_request(client: TestClient, compress):
        n = 1000
        headers = {}
        body = [1] * n
        data = json.dumps(body).encode()
        if compress:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_path_params/test_tutorial003.py

    import pytest
    from fastapi.testclient import TestClient
    
    from docs_src.path_params.tutorial003_py39 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        ("user_id", "expected_response"),
        [
            ("me", {"user_id": "the current user"}),
            ("alice", {"user_id": "alice"}),
        ],
    )
    def test_get_users(user_id: str, expected_response: dict):
        response = client.get(f"/users/{user_id}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_python_types/test_tutorial001_tutorial002.py

    import runpy
    from unittest.mock import patch
    
    import pytest
    
    
    @pytest.mark.parametrize(
        "module_name",
        [
            "tutorial001_py39",
            "tutorial002_py39",
        ],
    )
    def test_run_module(module_name: str):
        with patch("builtins.print") as mock_print:
            runpy.run_module(f"docs_src.python_types.{module_name}", run_name="__main__")
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 398 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_response_model/test_tutorial003_04.py

    import importlib
    
    import pytest
    from fastapi.exceptions import FastAPIError
    
    from ...utils import needs_py310
    
    
    @pytest.mark.parametrize(
        "module_name",
        [
            pytest.param("tutorial003_04_py39"),
            pytest.param("tutorial003_04_py310", marks=needs_py310),
        ],
    )
    def test_invalid_response_model(module_name: str) -> None:
        with pytest.raises(FastAPIError):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 453 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_query_params/test_tutorial001.py

        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.query_params.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    @pytest.mark.parametrize(
        ("path", "expected_json"),
        [
            (
                "/items/",
                [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}],
            ),
            (
                "/items/?skip=1",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.1K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_query_params/test_tutorial002.py

        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.query_params.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    @pytest.mark.parametrize(
        ("path", "expected_json"),
        [
            (
                "/items/foo",
                {"item_id": "foo"},
            ),
            (
                "/items/bar?q=somequery",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.2K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_dependencies/test_tutorial005.py

        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.dependencies.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    @pytest.mark.parametrize(
        "path,cookie,expected_status,expected_response",
        [
            (
                "/items",
                "from_cookie",
                200,
                {"q_or_cookie": "from_cookie"},
            ),
            (
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.5K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_python_types/test_tutorial011.py

    import runpy
    from unittest.mock import patch
    
    import pytest
    
    from ...utils import needs_py310
    
    
    @pytest.mark.parametrize(
        "module_name",
        [
            pytest.param("tutorial011_py39"),
            pytest.param("tutorial011_py310", marks=needs_py310),
        ],
    )
    def test_run_module(module_name: str):
        with patch("builtins.print") as mock_print:
            runpy.run_module(f"docs_src.python_types.{module_name}", run_name="__main__")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 691 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_first_steps/test_tutorial001_tutorial002_tutorial003.py

        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.first_steps.{request.param}")
        client = TestClient(mod.app)
        return client
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/", 200, {"message": "Hello World"}),
            ("/nonexistent", 404, {"detail": "Not Found"}),
        ],
    )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.4K bytes
    - Viewed (0)
Back to top