Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for listo (0.14 sec)

  1. tests/test_compat.py

        # to be read from files and other types, but I'm not even sure it's a good idea
        # to support it as a first class "feature"
        assert is_bytes_sequence_annotation(Union[List[str], List[bytes]])
    
    
    def test_is_uploadfile_sequence_annotation():
        # For coverage
        # TODO: in theory this would allow declaring types that could be lists of UploadFile
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_custom_request_and_route/test_tutorial002.py

        assert response.json() == IsDict(
            {
                "detail": {
                    "errors": [
                        {
                            "type": "list_type",
                            "loc": ["body"],
                            "msg": "Input should be a valid list",
                            "input": {"numbers": [1, 2, 3]},
                        }
                    ],
                    "body": '{"numbers": [1, 2, 3]}',
                }
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  3. tests/test_validate_response_dataclass.py

    from typing import List, Optional
    
    import pytest
    from fastapi import FastAPI
    from fastapi.exceptions import ResponseValidationError
    from fastapi.testclient import TestClient
    from pydantic.dataclasses import dataclass
    
    app = FastAPI()
    
    
    @dataclass
    class Item:
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/invalid", response_model=Item)
    def get_invalid():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  4. tests/test_invalid_path_param.py

    from typing import Dict, List, Tuple
    
    import pytest
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    def test_invalid_sequence():
        with pytest.raises(AssertionError):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/{id}")
            def read_items(id: List[Item]):
                pass  # pragma: no cover
    
    
    def test_invalid_tuple():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jun 03 17:59:40 GMT 2019
    - 1.7K bytes
    - Viewed (0)
  5. docs_src/body_nested_models/tutorial007.py

    from typing import List, Set, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel, HttpUrl
    
    app = FastAPI()
    
    
    class Image(BaseModel):
        url: HttpUrl
        name: str
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
        images: Union[List[Image], None] = None
    
    
    class Offer(BaseModel):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 581 bytes
    - Viewed (0)
  6. docs_src/dataclasses/tutorial002.py

    from dataclasses import dataclass, field
    from typing import List, Union
    
    from fastapi import FastAPI
    
    
    @dataclass
    class Item:
        name: str
        price: float
        tags: List[str] = field(default_factory=list)
        description: Union[str, None] = None
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.get("/items/next", response_model=Item)
    async def read_next_item():
        return {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 552 bytes
    - Viewed (0)
  7. docs_src/sql_databases_peewee/sql_app/main.py

        return crud.create_user_item(item=item, user_id=user_id)
    
    
    @app.get("/items/", response_model=List[schemas.Item], dependencies=[Depends(get_db)])
    def read_items(skip: int = 0, limit: int = 100):
        items = crud.get_items(skip=skip, limit=limit)
        return items
    
    
    @app.get(
        "/slowusers/", response_model=List[schemas.User], dependencies=[Depends(get_db)]
    )
    def read_slow_users(skip: int = 0, limit: int = 100):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 2.2K bytes
    - Viewed (0)
  8. tests/test_dependency_security_overrides.py

        return [3, 4, 5]
    
    
    @app.get("/user")
    def read_user(
        user_data: Tuple[str, List[str]] = Security(get_user, scopes=["foo", "bar"]),
        data: List[int] = Depends(get_data),
    ):
        return {"user": user_data[0], "scopes": user_data[1], "data": data}
    
    
    client = TestClient(app)
    
    
    def test_normal():
        response = client.get("/user")
        assert response.json() == {
            "user": "john",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jun 14 15:54:46 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  9. docs_src/path_operation_advanced_configuration/tutorial007_pv1.py

    from typing import List
    
    import yaml
    from fastapi import FastAPI, HTTPException, Request
    from pydantic import BaseModel, ValidationError
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        tags: List[str]
    
    
    @app.post(
        "/items/",
        openapi_extra={
            "requestBody": {
                "content": {"application/x-yaml": {"schema": Item.schema()}},
                "required": True,
            },
        },
    )
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 789 bytes
    - Viewed (0)
  10. docs_src/generate_clients/tutorial003.py

    from typing import List
    
    from fastapi import FastAPI
    from fastapi.routing import APIRoute
    from pydantic import BaseModel
    
    
    def custom_generate_unique_id(route: APIRoute):
        return f"{route.tags[0]}-{route.name}"
    
    
    app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
    
    
    class Item(BaseModel):
        name: str
        price: float
    
    
    class ResponseMessage(BaseModel):
        message: str
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 04 22:02:18 GMT 2022
    - 939 bytes
    - Viewed (0)
Back to top