Home / Function/ test_post_invalid_item() — fastapi Function Reference

test_post_invalid_item() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4aab525d_40c0_ae49_da2c_36736f89b496["test_post_invalid_item()"]
  fcae2ee4_8d3a_548b_76ff_91bbfcc452b4["test_tutorial001.py"]
  4aab525d_40c0_ae49_da2c_36736f89b496 -->|defined in| fcae2ee4_8d3a_548b_76ff_91bbfcc452b4
  style 4aab525d_40c0_ae49_da2c_36736f89b496 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_dataclasses/test_tutorial001.py lines 36–48

def test_post_invalid_item(client: TestClient):
    response = client.post("/items/", json={"name": "Foo", "price": "invalid price"})
    assert response.status_code == 422
    assert response.json() == {
        "detail": [
            {
                "type": "float_parsing",
                "loc": ["body", "price"],
                "msg": "Input should be a valid number, unable to parse string as a number",
                "input": "invalid price",
            }
        ]
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free