Home / Function/ test_query_param_model_invalid() — fastapi Function Reference

test_query_param_model_invalid() — fastapi Function Reference

Architecture documentation for the test_query_param_model_invalid() function in test_tutorial001.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  ae5d93f3_8f7d_fe68_6f84_958a8c6aa797["test_query_param_model_invalid()"]
  11f1f42c_0004_a81c_09c0_0e775a110295["test_tutorial001.py"]
  ae5d93f3_8f7d_fe68_6f84_958a8c6aa797 -->|defined in| 11f1f42c_0004_a81c_09c0_0e775a110295
  style ae5d93f3_8f7d_fe68_6f84_958a8c6aa797 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_query_param_models/test_tutorial001.py lines 56–92

def test_query_param_model_invalid(client: TestClient):
    response = client.get(
        "/items/",
        params={
            "limit": 150,
            "offset": -1,
            "order_by": "invalid",
        },
    )
    assert response.status_code == 422
    assert response.json() == snapshot(
        {
            "detail": [
                {
                    "type": "less_than_equal",
                    "loc": ["query", "limit"],
                    "msg": "Input should be less than or equal to 100",
                    "input": "150",
                    "ctx": {"le": 100},
                },
                {
                    "type": "greater_than_equal",
                    "loc": ["query", "offset"],
                    "msg": "Input should be greater than or equal to 0",
                    "input": "-1",
                    "ctx": {"ge": 0},
                },
                {
                    "type": "literal_error",
                    "loc": ["query", "order_by"],
                    "msg": "Input should be 'created_at' or 'updated_at'",
                    "input": "invalid",
                    "ctx": {"expected": "'created_at' or 'updated_at'"},
                },
            ]
        }
    )

Domain

Subdomains

Frequently Asked Questions

What does test_query_param_model_invalid() do?
test_query_param_model_invalid() is a function in the fastapi codebase, defined in tests/test_tutorial/test_query_param_models/test_tutorial001.py.
Where is test_query_param_model_invalid() defined?
test_query_param_model_invalid() is defined in tests/test_tutorial/test_query_param_models/test_tutorial001.py at line 56.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free