Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 296 for foo3 (0.02 seconds)

  1. tests/test_tutorial/test_body_updates/test_tutorial002.py

    
    def test_patch_all(client: TestClient):
        response = client.patch(
            "/items/foo",
            json={
                "name": "Fooz",
                "description": "Item description",
                "price": 3,
                "tax": 10.5,
                "tags": ["tag1", "tag2"],
            },
        )
        assert response.json() == {
            "name": "Fooz",
            "description": "Item description",
            "price": 3,
            "tax": 10.5,
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 7.1K bytes
    - Click Count (0)
  2. tests/test_generate_unique_id_function.py

    from fastapi import APIRouter, FastAPI
    from fastapi.routing import APIRoute
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    
    def custom_generate_unique_id(route: APIRoute):
        return f"foo_{route.name}"
    
    
    def custom_generate_unique_id2(route: APIRoute):
        return f"bar_{route.name}"
    
    
    def custom_generate_unique_id3(route: APIRoute):
        return f"baz_{route.name}"
    
    
    class Item(BaseModel):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 66.7K bytes
    - Click Count (0)
  3. docs_src/app_testing/app_b_py39/test_main.py

    client = TestClient(app)
    
    
    def test_read_item():
        response = client.get("/items/foo", headers={"X-Token": "coneofsilence"})
        assert response.status_code == 200
        assert response.json() == {
            "id": "foo",
            "title": "Foo",
            "description": "There goes my hero",
        }
    
    
    def test_read_item_bad_token():
        response = client.get("/items/foo", headers={"X-Token": "hailhydra"})
        assert response.status_code == 400
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 1.8K bytes
    - Click Count (0)
  4. tests/test_extra_routes.py

        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": "foo", "item": {"name": "Foo", "price": None}}
    
    
    def test_head():
        response = client.head("/items/foo")
        assert response.status_code == 200, response.text
        assert response.headers["x-fastapi-item-id"] == "foo"
    
    
    def test_options():
        response = client.options("/items/foo")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 13.5K bytes
    - Click Count (0)
  5. tests/test_annotated.py

    app = FastAPI()
    
    
    @app.get("/default")
    async def default(foo: Annotated[str, Query()] = "foo"):
        return {"foo": foo}
    
    
    @app.get("/required")
    async def required(foo: Annotated[str, Query(min_length=1)]):
        return {"foo": foo}
    
    
    @app.get("/multiple")
    async def multiple(foo: Annotated[str, object(), Query(min_length=1)]):
        return {"foo": foo}
    
    
    @app.get("/unrelated")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 9.6K bytes
    - Click Count (0)
  6. tests/test_tutorial/test_body/test_tutorial001.py

            "tax": None,
        }
    
    
    def test_post_with_str_float_description_tax(client: TestClient):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": "50.5", "description": "Some Foo", "tax": 0.3},
        )
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 50.5,
            "description": "Some Foo",
            "tax": 0.3,
        }
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 10.6K bytes
    - Click Count (0)
  7. tests/test_tutorial/test_body_multiple_params/test_tutorial005.py

                "item": {
                    "name": "Foo",
                    "price": 50.5,
                    "description": "Some Foo",
                    "tax": 0.1,
                },
            },
        )
        assert response.status_code == 200
        assert response.json() == {
            "item_id": 5,
            "item": {
                "name": "Foo",
                "price": 50.5,
                "description": "Some Foo",
                "tax": 0.1,
            },
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 8.2K bytes
    - Click Count (0)
  8. tests/test_jsonable_encoder.py

        assert jsonable_encoder(model, exclude_defaults=True) == {"foo": "foo"}
        assert jsonable_encoder(model, exclude_unset=True, exclude_defaults=True) == {
            "foo": "foo"
        }
        assert jsonable_encoder(model, include={"foo"}) == {"foo": "foo"}
        assert jsonable_encoder(model, exclude={"bla"}) == {"foo": "foo", "bar": "bar"}
        assert jsonable_encoder(model, include={}) == {}
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 9.2K bytes
    - Click Count (0)
  9. tests/test_additional_properties_bool.py

    class FooBaseModel(BaseModel):
        model_config = ConfigDict(extra="forbid")
    
    
    class Foo(FooBaseModel):
        pass
    
    
    app = FastAPI()
    
    
    @app.post("/")
    async def post(
        foo: Union[Foo, None] = None,
    ):
        return foo
    
    
    client = TestClient(app)
    
    
    def test_call_invalid():
        response = client.post("/", json={"foo": {"bar": "baz"}})
        assert response.status_code == 422
    
    
    def test_call_valid():
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 3.7K bytes
    - Click Count (0)
  10. tests/test_tutorial/test_body_nested_models/test_tutorial001_tutorial002_tutorial003.py

            tags_expected = IsList("foo", "bar", check_order=False)
        else:
            tags_expected = ["foo", "bar", "foo"]
    
        response = client.put(
            "/items/123",
            json={
                "name": "Foo",
                "description": "A very nice Item",
                "price": 35.4,
                "tax": 3.2,
                "tags": ["foo", "bar", "foo"],
            },
        )
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 7.9K bytes
    - Click Count (0)
Back to Top