MCPcopy Index your code
hub / github.com/msgspec/msgspec / test_struct_meta_field_processing

Function test_struct_meta_field_processing

tests/unit/test_struct_meta.py:49–64  ·  view source on GitHub ↗

Test that StructMeta properly processes fields.

()

Source from the content-addressed store, hash-verified

47
48
49def test_struct_meta_field_processing():
50 """Test that StructMeta properly processes fields."""
51
52 class CustomStruct(metaclass=StructMeta):
53 x: int
54 y: str = "default"
55
56 # Verify struct functionality
57 instance = CustomStruct(x=1)
58 assert instance.x == 1
59 assert instance.y == "default"
60
61 # Check struct metadata
62 assert hasattr(CustomStruct, "__struct_fields__")
63 assert "x" in CustomStruct.__struct_fields__
64 assert "y" in CustomStruct.__struct_fields__
65
66
67def test_struct_meta_with_struct_base():

Callers

nothing calls this directly

Calls 1

CustomStructClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…