Home / Function/ test_unknown_fields() — anthropic-sdk-python Function Reference

test_unknown_fields() — anthropic-sdk-python Function Reference

Architecture documentation for the test_unknown_fields() function in test_models.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  46b7519f_8235_730c_5d26_fc1a900343ce["test_unknown_fields()"]
  7872e60b_4210_5600_119f_c5d08c52091e["test_models.py"]
  46b7519f_8235_730c_5d26_fc1a900343ce -->|defined in| 7872e60b_4210_5600_119f_c5d08c52091e
  style 46b7519f_8235_730c_5d26_fc1a900343ce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_models.py lines 148–157

def test_unknown_fields() -> None:
    m1 = BasicModel.construct(foo="foo", unknown=1)
    assert m1.foo == "foo"
    assert cast(Any, m1).unknown == 1

    m2 = BasicModel.construct(foo="foo", unknown={"foo_bar": True})
    assert m2.foo == "foo"
    assert cast(Any, m2).unknown == {"foo_bar": True}

    assert model_dump(m2) == {"foo": "foo", "unknown": {"foo_bar": True}}

Subdomains

Frequently Asked Questions

What does test_unknown_fields() do?
test_unknown_fields() is a function in the anthropic-sdk-python codebase, defined in tests/test_models.py.
Where is test_unknown_fields() defined?
test_unknown_fields() is defined in tests/test_models.py at line 148.

Analyze Your Own Codebase

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

Try Supermodel Free