Home / Function/ test_wrapped_method_type_inference() — fastapi Function Reference

test_wrapped_method_type_inference() — fastapi Function Reference

Architecture documentation for the test_wrapped_method_type_inference() function in test_wrapped_method_forward_reference.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  902c47b9_e5b2_9a6e_8a37_e62bb8b772d0["test_wrapped_method_type_inference()"]
  25760a4c_6a1b_5167_f4ca_a5b253a766bd["test_wrapped_method_forward_reference.py"]
  902c47b9_e5b2_9a6e_8a37_e62bb8b772d0 -->|defined in| 25760a4c_6a1b_5167_f4ca_a5b253a766bd
  60fc2eaf_dead_15cf_1d93_3b1f96e56df9["passthrough()"]
  902c47b9_e5b2_9a6e_8a37_e62bb8b772d0 -->|calls| 60fc2eaf_dead_15cf_1d93_3b1f96e56df9
  style 902c47b9_e5b2_9a6e_8a37_e62bb8b772d0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_wrapped_method_forward_reference.py lines 17–31

def test_wrapped_method_type_inference():
    """
    Regression test ensuring that when a method imported from another module
    is decorated with something that sets the __wrapped__ attribute (functools.wraps),
    then the types are still processed correctly, including dereferencing of forward
    references.
    """
    app = FastAPI()
    client = TestClient(app)
    app.post("/endpoint")(passthrough(forwardref_method))
    app.post("/endpoint2")(passthrough(passthrough(forwardref_method)))
    with client:
        response = client.post("/endpoint", json={"input": {"x": 0}})
        response2 = client.post("/endpoint2", json={"input": {"x": 0}})
    assert response.json() == response2.json() == {"x": 1}

Domain

Subdomains

Frequently Asked Questions

What does test_wrapped_method_type_inference() do?
test_wrapped_method_type_inference() is a function in the fastapi codebase, defined in tests/test_wrapped_method_forward_reference.py.
Where is test_wrapped_method_type_inference() defined?
test_wrapped_method_type_inference() is defined in tests/test_wrapped_method_forward_reference.py at line 17.
What does test_wrapped_method_type_inference() call?
test_wrapped_method_type_inference() calls 1 function(s): passthrough.

Analyze Your Own Codebase

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

Try Supermodel Free