MCPcopy Create free account
hub / github.com/msgspec/msgspec / test_subclass

Method test_subclass

tests/unit/test_utils.py:51–75  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

49 assert get_class_annotations(Ex) == {"x": type(None)}
50
51 def test_subclass(self):
52 class Base:
53 x: int
54 y: str
55
56 class Sub(Base):
57 x: float
58 z: list
59
60 class Base2:
61 a: int
62
63 class Sub2(Sub, Base2):
64 b: float
65 y: list
66
67 assert get_class_annotations(Base) == {"x": int, "y": str}
68 assert get_class_annotations(Sub) == {"x": float, "y": str, "z": list}
69 assert get_class_annotations(Sub2) == {
70 "x": float,
71 "y": list,
72 "z": list,
73 "a": int,
74 "b": float,
75 }
76
77 def test_simple_generic(self):
78 class Test(Generic[T]):

Callers

nothing calls this directly

Calls 1

get_class_annotationsFunction · 0.90

Tested by

no test coverage detected