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

Method test_repr_omit_defaults_one_field

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

Source from the content-addressed store, hash-verified

729 assert x.__rich_repr__() == []
730
731 def test_repr_omit_defaults_one_field(self):
732 class Test(Struct, repr_omit_defaults=True):
733 a: int = 0
734
735 x = Test(0)
736 assert repr(x) == "Test()"
737 assert x.__rich_repr__() == []
738
739 x = Test(1)
740 assert repr(x) == "Test(a=1)"
741 assert x.__rich_repr__() == [("a", 1)]
742
743 def test_repr_omit_defaults_multiple_fields(self):
744 class Test(Struct, repr_omit_defaults=True):

Callers

nothing calls this directly

Calls 1

TestClass · 0.70

Tested by

no test coverage detected