(self)
| 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): |