Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for 42 (0.15 sec)

  1. tests/test_query.py

                    }
                ]
            }
        )
    
    
    def test_query_int_query_42():
        response = client.get("/query/int?query=42")
        assert response.status_code == 200
        assert response.json() == "foo bar 42"
    
    
    def test_query_int_query_42_5():
        response = client.get("/query/int?query=42.5")
        assert response.status_code == 422
        assert response.json() == IsDict(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 11.4K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py

    from docs_src.path_operation_configuration.tutorial006 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/items/", 200, [{"name": "Foo", "price": 42}]),
            ("/users/", 200, [{"username": "johndoe"}]),
            ("/elements/", 200, [{"item_id": "Foo"}]),
        ],
    )
    def test_query_params_str_validations(path, expected_status, expected_response):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.3K bytes
    - Viewed (0)
  3. docs/pt/docs/advanced/templates.md

    ```jinja
    Item ID: {{ id }}
    ```
    
    {% endraw %}
    
    ...aparecerá o `id` obtido do "context" `dict` que você passou:
    
    ```Python
    {"id": id}
    ```
    
    Por exemplo, dado um ID de valor `42`, aparecerá:
    
    ```html
    Item ID: 42
    ```
    
    ### Argumentos do `url_for`
    
    Você também pode usar `url_for()` dentro do template, ele recebe como argumentos os mesmos argumentos que seriam usados pela sua *path operation function*.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 28 04:05:17 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  4. docs_src/path_operation_configuration/tutorial002.py

    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 580 bytes
    - Viewed (0)
  5. docs_src/path_operation_configuration/tutorial002_py39.py

    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 575 bytes
    - Viewed (0)
  6. docs/de/docs/advanced/templates.md

    {% endraw %}
    
    ... wird die `id` angezeigt, welche dem „Kontext“-`dict` entnommen wird, welches Sie übergeben haben:
    
    ```Python
    {"id": id}
    ```
    
    Mit beispielsweise einer ID `42` würde das wie folgt gerendert werden:
    
    ```html
    Item ID: 42
    ```
    
    ### Template-`url_for`-Argumente
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:26:19 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  7. docs/em/docs/advanced/nosql-databases.md

    ```Python hl_lines="36-42"
    {!../../../docs_src/nosql_databases/tutorial001.py!}
    ```
    
    ### Ⓜ-🎻
    
    Plain Text
    - Registered: Sun Mar 31 07:19:09 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 4.8K bytes
    - Viewed (0)
  8. docs_src/events/tutorial003.py

    from contextlib import asynccontextmanager
    
    from fastapi import FastAPI
    
    
    def fake_answer_to_everything_ml_model(x: float):
        return x * 42
    
    
    ml_models = {}
    
    
    @asynccontextmanager
    async def lifespan(app: FastAPI):
        # Load the ML model
        ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
        yield
        # Clean up the ML models and release the resources
        ml_models.clear()
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 07 15:46:00 GMT 2023
    - 569 bytes
    - Viewed (0)
  9. docs_src/path_operation_configuration/tutorial002_py310.py

    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 537 bytes
    - Viewed (0)
  10. tests/test_path.py

                        "type": "type_error.integer",
                    }
                ]
            }
        )
    
    
    def test_path_int_42():
        response = client.get("/path/int/42")
        assert response.status_code == 200
        assert response.json() == 42
    
    
    def test_path_int_42_5():
        response = client.get("/path/int/42.5")
        assert response.status_code == 422
        assert response.json() == IsDict(
            {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 34.4K bytes
    - Viewed (0)
Back to top