Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 128 for item01 (0.04 sec)

  1. tests/test_infer_param_optionality.py

    
    def test_get_item_1():
        """Check that /items/{item_id} returns expected data"""
        response = client.get("/items/item01")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": "item01"}
    
    
    def test_get_item_2():
        """Check that /items/{item_id} returns expected data with user_id specified"""
        response = client.get("/items/item01?user_id=abc123")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 12.1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_python_types/test_tutorial005.py

    from docs_src.python_types.tutorial005_py39 import get_items
    
    
    def test_get_items():
        res = get_items(
            "item_a",
            "item_b",
            "item_c",
            "item_d",
            "item_e",
        )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 271 bytes
    - Viewed (0)
  3. tests/test_schema_extra_examples.py

                return item
    
        @app.post("/examples/")
        def examples(
            item: Item = Body(
                examples=[
                    {"data": "Data in Body examples, example1"},
                    {"data": "Data in Body examples, example2"},
                ],
            ),
        ):
            return item
    
        with pytest.warns(FastAPIDeprecationWarning):
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 32.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_path_params/test_tutorial002.py

    def test_get_items():
        response = client.get("/items/1")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": 1}
    
    
    def test_get_items_invalid_id():
        response = client.get("/items/item1")
        assert response.status_code == 422, response.text
        assert response.json() == {
            "detail": [
                {
                    "input": "item1",
                    "loc": ["path", "item_id"],
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.2K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_python_types/test_tutorial006.py

    
    def test_process_items():
        with patch("builtins.print") as mock_print:
            process_items(["item_a", "item_b", "item_c"])
    
        assert mock_print.call_count == 3
        call_args = [arg.args for arg in mock_print.call_args_list]
        assert call_args == [
            ("item_a",),
            ("item_b",),
            ("item_c",),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 426 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_extra_models/test_tutorial003.py

    
    def test_get_car(client: TestClient):
        response = client.get("/items/item1")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "description": "All my friends drive a low rider",
            "type": "car",
        }
    
    
    def test_get_plane(client: TestClient):
        response = client.get("/items/item2")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6K bytes
    - Viewed (0)
  7. tests/test_openapi_examples.py

    from fastapi import Body, Cookie, FastAPI, Header, Path, Query
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        data: str
    
    
    @app.post("/examples/")
    def examples(
        item: Item = Body(
            examples=[
                {"data": "Data in Body examples, example1"},
            ],
            openapi_examples={
                "Example One": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  8. tests/test_dependency_duplicates.py

        return [item, item2]
    
    
    @app.post("/no-duplicates")
    async def no_duplicates(item: Item, item2: Item = Depends(dependency)):
        return [item, item2]
    
    
    @app.post("/with-duplicates-sub")
    async def no_duplicates_sub(
        item: Item, sub_items: list[Item] = Depends(sub_duplicate_dependency)
    ):
        return [item, sub_items]
    
    
    def test_no_duplicates_invalid():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8K bytes
    - Viewed (0)
  9. tests/benchmarks/test_general_performance.py

    
    class LargeOut(BaseModel):
        items: list[dict[str, Any]]
        metadata: dict[str, Any]
    
    
    app = FastAPI()
    
    
    @app.post("/sync/validated", response_model=ItemOut)
    def sync_validated(item: ItemIn, dep: Annotated[int, Depends(dep_b)]):
        return ItemOut(name=item.name, value=item.value, dep=dep)
    
    
    @app.get("/sync/dict-no-response-model")
    def sync_dict_no_response_model():
        return {"name": "foo", "value": 123}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 20:40:26 UTC 2025
    - 11.1K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_body_updates/test_tutorial002.py

                "price": 3,
                "tax": 10.5,
                "tags": ["tag1", "tag2"],
            },
        )
        assert response.json() == {
            "name": "Fooz",
            "description": "Item description",
            "price": 3,
            "tax": 10.5,
            "tags": ["tag1", "tag2"],
        }
    
    
    def test_patch_name(client: TestClient):
        response = client.patch(
            "/items/bar",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7.1K bytes
    - Viewed (0)
Back to top