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

Method test_post_init_errors

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

Source from the content-addressed store, hash-verified

2627 assert sys.getrefcount(singleton) <= 2 # 1 for ref, 1 for call
2628
2629 def test_post_init_errors(self):
2630 class Ex(Struct):
2631 x: int
2632
2633 def __post_init__(self):
2634 raise ValueError("Oh no!")
2635
2636 with pytest.raises(ValueError, match="Oh no!"):
2637 Ex(1)
2638
2639 def test_post_init_invalid(self):
2640 class Bad1(Struct):

Callers

nothing calls this directly

Calls 1

ExClass · 0.70

Tested by

no test coverage detected