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

Method test_defstruct_bases

tests/unit/test_struct.py:2163–2171  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2161 defstruct("Test", [], namespace=1)
2162
2163 def test_defstruct_bases(self):
2164 class Base(Struct):
2165 z: int
2166
2167 Point = defstruct("Point", ["x", "y"], bases=(Base,))
2168 assert issubclass(Point, Base)
2169 assert issubclass(Point, Struct)
2170 assert as_tuple(Point(1, 2, 0)) == (1, 2, 0)
2171 assert as_tuple(Point(1, 2, 3)) == (1, 2, 3)
2172
2173 def test_defstruct_bases_none(self):
2174 Point = defstruct("Point", ["x", "y"], bases=None)

Callers

nothing calls this directly

Calls 2

as_tupleFunction · 0.85
PointClass · 0.70

Tested by

no test coverage detected