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

Function test_struct_meta_direct_usage

tests/unit/test_struct_meta.py:22–34  ·  view source on GitHub ↗

Test that StructMeta can be used directly as a metaclass.

()

Source from the content-addressed store, hash-verified

20
21
22def test_struct_meta_direct_usage():
23 """Test that StructMeta can be used directly as a metaclass."""
24
25 class CustomStruct(metaclass=StructMeta):
26 x: int
27 y: str
28
29 # Verify the struct works as expected
30 instance = CustomStruct(x=1, y="test")
31 assert instance.x == 1
32 assert instance.y == "test"
33 assert isinstance(instance, CustomStruct)
34 assert isinstance(CustomStruct, StructMeta)
35
36
37def test_struct_meta_options():

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…