MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_custom_repr

Method test_custom_repr

testing/test_assertrewrite.py:719–736  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

717 assert msg.startswith("assert '%test' == 'test'")
718
719 def test_custom_repr(self, request) -> None:
720 def f() -> None:
721 class Foo:
722 a = 1
723
724 def __repr__(self):
725 return "\n{ \n~ \n}"
726
727 f = Foo()
728 assert 0 == f.a
729
730 msg = getmsg(f)
731 assert msg is not None
732 lines = util._format_lines([msg])
733 if request.config.getoption("verbose") > 0:
734 assert lines == ["assert 0 == 1\n +0\n -1"]
735 else:
736 assert lines == ["assert 0 == 1\n + where 1 = \\n{ \\n~ \\n}.a"]
737
738 def test_custom_repr_non_ascii(self) -> None:
739 def f() -> None:

Callers

nothing calls this directly

Calls 2

getmsgFunction · 0.85
getoptionMethod · 0.45

Tested by

no test coverage detected