(self)
| 786 | t.__rich_repr__() |
| 787 | |
| 788 | def test_repr_errors(self): |
| 789 | msg = "Oh no!" |
| 790 | |
| 791 | class Bad: |
| 792 | def __repr__(self): |
| 793 | raise ValueError(msg) |
| 794 | |
| 795 | class Test(Struct): |
| 796 | a: object |
| 797 | b: object |
| 798 | |
| 799 | t = Test(1, Bad()) |
| 800 | |
| 801 | with pytest.raises(ValueError, match=msg): |
| 802 | repr(t) |
| 803 | |
| 804 | |
| 805 | def test_struct_copy(): |