[py-dev] Bug with py.test when object repr contains "\n"

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Wed Jun 1 14:32:54 CEST 2005


Here an example :


class Foo( object ):
    def __init__( self, a,b ):
        self.a = a
        self.b = b

    def __repr__( self ):
        return "Toto(%d,\n%d)" %( self.a, self.b )

    def __len__( self ):
        return 2

def test_foo():
    bar = Foo( 3,4 )
    assert len( bar ) == 3


If you try to put that in a file a run py.test, it will fail in the
nice_explanation function. This can be annoying :(

I did not see any former reports about that !

Pierre

-- 
Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68



More information about the Pytest-dev mailing list