Search Options

Results per page
Sort
Preferred Languages
Advance

Results 411 - 420 of 641 for tutorial006_py39 (0.06 sec)

  1. tests/test_tutorial/test_middleware/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.middleware.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_response_headers():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert "X-Process-Time" in response.headers
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 604 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_python_types/test_tutorial003.py

    import pytest
    
    from docs_src.python_types.tutorial003_py39 import get_name_with_age
    
    
    def test_get_name_with_age_pass_int():
        with pytest.raises(TypeError):
            get_name_with_age("John", 30)
    
    
    def test_get_name_with_age_pass_str():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 308 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_python_types/test_tutorial008.py

    from unittest.mock import patch
    
    from docs_src.python_types.tutorial008_py39 import process_items
    
    
    def test_process_items():
        with patch("builtins.print") as mock_print:
            process_items({"a": 1.0, "b": 2.5})
    
        assert mock_print.call_count == 4
        call_args = [arg.args for arg in mock_print.call_args_list]
        assert call_args == [
            ("a",),
            (1.0,),
            ("b",),
            (2.5,),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 417 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_response_headers/test_tutorial002.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_headers.tutorial002_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/headers-and-object/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Hello World"}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 383 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_response_headers/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_headers.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/headers/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Hello World"}
        assert response.headers["X-Cat-Dog"] == "alone in the world"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 431 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_custom_request_and_route/test_tutorial002.py

    import pytest
    from dirty_equals import IsOneOf
    from fastapi.testclient import TestClient
    
    from tests.utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial002_py39"),
            pytest.param("tutorial002_py310", marks=needs_py310),
            pytest.param("tutorial002_an_py39"),
            pytest.param("tutorial002_an_py310", marks=needs_py310),
        ],
    )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_metadata/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.metadata.tutorial003_py39 import app
    
    client = TestClient(app)
    
    
    def test_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"name": "Foo"}]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.5K bytes
    - Viewed (0)
  8. docs/ru/docs/advanced/testing-websockets.md

    Вы можете использовать тот же `TestClient` для тестирования WebSocket.
    
    Для этого используйте `TestClient` с менеджером контекста `with`, подключаясь к WebSocket:
    
    {* ../../docs_src/app_testing/tutorial002_py39.py hl[27:31] *}
    
    /// note | Примечание
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 655 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_response_directly/test_tutorial002.py

    import importlib
    
    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial002_py39"),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.response_directly.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_path_operation(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_advanced_middleware/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.advanced_middleware.tutorial001_py39 import app
    
    
    def test_middleware():
        client = TestClient(app, base_url="https://testserver")
        response = client.get("/")
        assert response.status_code == 200, response.text
    
        client = TestClient(app)
        response = client.get("/", follow_redirects=False)
        assert response.status_code == 307, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 479 bytes
    - Viewed (0)
Back to top