Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 285 for bhar (0.15 sec)

  1. tests/test_serialize_response.py

    def get_coerce():
        return {"name": "coerce", "price": "1.0"}
    
    
    @app.get("/items/validlist", response_model=List[Item])
    def get_validlist():
        return [
            {"name": "foo"},
            {"name": "bar", "price": 1.0},
            {"name": "baz", "price": 2.0, "owner_ids": [1, 2, 3]},
        ]
    
    
    client = TestClient(app)
    
    
    def test_valid():
        response = client.get("/items/valid")
        response.raise_for_status()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Aug 03 12:29:07 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_query_params_str_validations/test_tutorial010_an.py

        assert response.json() == {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
    
    
    def test_query_params_str_validations_item_query_fixedquery(client: TestClient):
        response = client.get("/items/", params={"item-query": "fixedquery"})
        assert response.status_code == 200
        assert response.json() == {
            "items": [{"item_id": "Foo"}, {"item_id": "Bar"}],
            "q": "fixedquery",
        }
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  3. docs_src/app_testing/app_b_an/test_main.py

        response = client.post(
            "/items/",
            headers={"X-Token": "coneofsilence"},
            json={"id": "foobar", "title": "Foo Bar", "description": "The Foo Barters"},
        )
        assert response.status_code == 200
        assert response.json() == {
            "id": "foobar",
            "title": "Foo Bar",
            "description": "The Foo Barters",
        }
    
    
    def test_create_item_bad_token():
        response = client.post(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  4. docs/fr/docs/tutorial/query-params-str-validations.md

    ```
    http://localhost:8000/items/?q=foo&q=bar
    ```
    
    vous recevriez les valeurs des multiples paramètres de requête `q` (`foo` et `bar`) dans une `list` Python au sein de votre fonction de **path operation**, dans le paramètre de fonction `q`.
    
    Donc la réponse de cette URL serait :
    
    ```JSON
    {
      "q": [
        "foo",
        "bar"
      ]
    }
    ```
    
    !!! tip "Astuce"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jul 27 18:53:21 GMT 2023
    - 9.8K bytes
    - Viewed (0)
  5. tests/test_additional_properties.py

        return items.items
    
    
    client = TestClient(app)
    
    
    def test_additional_properties_post():
        response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}})
        assert response.status_code == 200, response.text
        assert response.json() == {"foo": 1, "bar": 2}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_query_params_str_validations/test_tutorial011_py310.py

        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_multi_query_values(client: TestClient):
        url = "/items/?q=foo&q=bar"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["foo", "bar"]}
    
    
    @needs_py310
    def test_query_no_values(client: TestClient):
        url = "/items/"
        response = client.get(url)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_header_params/test_tutorial003.py

            ("/items", {"x-token": "foo"}, 200, {"X-Token values": ["foo"]}),
            (
                "/items",
                [("x-token", "foo"), ("x-token", "bar")],
                200,
                {"X-Token values": ["foo", "bar"]},
            ),
        ],
    )
    def test(path, headers, expected_status, expected_response):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 12 14:52:00 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  8. tests/test_compat.py

        @app.post("/")
        def foo(foo: Union[str, List[int]]):
            return foo
    
        client = TestClient(app)
    
        response = client.post("/", json="bar")
        assert response.status_code == 200, response.text
        assert response.json() == "bar"
    
        response2 = client.post("/", json=[1, 2])
        assert response2.status_code == 200, response2.text
        assert response2.json() == [1, 2]
    
    
    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)
  9. tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py310.py

                                                    "price": 35.4,
                                                    "tax": 3.2,
                                                },
                                                {"name": "Bar", "price": "35.4"},
                                                {
                                                    "name": "Baz",
                                                    "price": "thirty five point four",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  10. docs_src/query_params_str_validations/tutorial012_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[list[str], Query()] = ["foo", "bar"]):
        query_items = {"q": q}
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 227 bytes
    - Viewed (0)
Back to top