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_tutorial002.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  0912b9de_0502_b06a_405f_598fa31b9ea8["test_query_param_model_invalid()"]
  403cc16e_3d5f_4324_0a51_b60b3753d450["test_tutorial002.py"]
  0912b9de_0502_b06a_405f_598fa31b9ea8 -->|defined in| 403cc16e_3d5f_4324_0a51_b60b3753d450
  style 0912b9de_0502_b06a_405f_598fa31b9ea8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_query_param_models/test_tutorial002.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_tutorial002.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_tutorial002.py at line 56.

Analyze Your Own Codebase

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

Try Supermodel Free