[pypy-dev] utest conversion tool question

Armin Rigo arigo at tunes.org
Thu Jul 1 17:44:02 CEST 2004


Hello Holger,

On Wed, Jun 30, 2004 at 09:05:05PM +0200, holger krekel wrote:
> >    self.assertEquals(f(x) +
> >                      g(x) == q(x),
> >                      'Message')
> > 
> > should, intuitively, get translated to...
> > 
> >   assert (f(x) +
> >                      g(x) == q(x)), (
> >                      'Message')
> 
> 
> Aehem, which kind of intuition are you invoking?

Well, I was assuming that f(x), g(x) and q(x) were actually much longer.  
Otherwise the original statement wouldn't have been split either.  For 
example:

    self.assertEquals(if_we_do_something("with a long string") +
                      "and concatenate that", then_we_get(2*3),
                      'Message')

    assert (if_we_do_something("with a long string") +
                      "and concatenate that" == then_we_get(2*3)), (
                      'Message')

In general I think we should not try to rearrange the lines too hard; 'assert'
is a bit shorter than 'self.assertEquals(' but then not dramatically so.  The
translation could be beautified by reindenting it entierely, but this looks
like a dangerous thing to do in the current model and isn't absolutely
necessary.


Armin



More information about the Pypy-dev mailing list