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

Method test_repr_errors

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

Source from the content-addressed store, hash-verified

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
805def test_struct_copy():

Callers

nothing calls this directly

Calls 2

TestClass · 0.70
BadClass · 0.70

Tested by

no test coverage detected