Esempio n. 1
0
    def test_custom_repr(self):
        def f():
            class Foo(object):
                a = 1

                def __repr__(self):
                    return "\n{ \n~ \n}"
            f = Foo()
            assert 0 == f.a
        assert r"where 1 = \n{ \n~ \n}.a" in util._format_lines([getmsg(f)])[0]
Esempio n. 2
0
    def test_custom_repr(self):
        def f():
            class Foo(object):
                a = 1

                def __repr__(self):
                    return "\n{ \n~ \n}"
            f = Foo()
            assert 0 == f.a
        assert r"where 1 = \n{ \n~ \n}.a" in util._format_lines([getmsg(f)])[0]
Esempio n. 3
0
    def test_custom_repr(self, request):
        def f():
            class Foo:
                a = 1

                def __repr__(self):
                    return "\n{ \n~ \n}"

            f = Foo()
            assert 0 == f.a

        lines = util._format_lines([getmsg(f)])
        if request.config.getoption("verbose") > 0:
            assert lines == ["assert 0 == 1\n  +0\n  -1"]
        else:
            assert lines == ["assert 0 == 1\n +  where 1 = \\n{ \\n~ \\n}.a"]
Esempio n. 4
0
    def test_custom_repr(self, request):
        def f():
            class Foo(object):
                a = 1

                def __repr__(self):
                    return "\n{ \n~ \n}"

            f = Foo()
            assert 0 == f.a

        lines = util._format_lines([getmsg(f)])
        if request.config.getoption("verbose") > 0:
            assert lines == ["assert 0 == 1\n  -0\n  +1"]
        else:
            assert lines == ["assert 0 == 1\n +  where 1 = \\n{ \\n~ \\n}.a"]