| 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: |