Laura Creighton | 1 Jul 2004 07:31
Favicon

Re: utest conversion tool question

In a message of Wed, 30 Jun 2004 20:55:34 +0200, holger krekel writes:
>Hey Laura, 
>
>[Laura Creighton Wed, Jun 30, 2004 at 04:43:25PM +0200]
>> I am still dizzy and sick, but I am trying to get something done anyhow
>.  I have
>> this question.
>
>ups, didn't know you were ill, but you seem to have fun recovering :-) 
>
>> If you start with
>> 
>> self.assertEquals(f(x) +
>>                   g(x) == q(x), 'Message to print when the assertion fa
>ils')
>
>Oh,                     ^^^^ you mean a comma here, i guess?!

Yes.  silly me.

>> you would like things to come back as
>> 
>> assert f(x) +\
>>                  g(x) == q(x), 'Message to print when the assertion fai
>ls'
>
>actually i'd prefer 
>
>  assert f(x) + g(x) == q(x), 'Message to print when the assertion fails'
>
(Continue reading)

Armin Rigo | 1 Jul 2004 17:39
Favicon

Re: [FW: Re: Patches?]

Hello,

Ben, welcome to PyPy!  Yes, patches are welcome and encouraged.  At this point
I guess that people interested to contribute can get check-in right easily
too.

> > The second is in pprint. If you do 
> > 
> > >>>> import pprint
> > >>>> pprint.pprint([])
> > 
> > you get a massive traceback which I haven't yet quite worked out a fix for.
> 
> This seems to work in the standard object space though.

It was a limitation of the trivial object space not accepting keyword
arguments in one of its dark internal relaying routines.  Fixed.

TrivialObjSpace is really not trivial at all.  I believe that ideally it
should be (1) renamed, (2) no longer the default.  Always run 'py.py -S'
unless you have a reason not to.

Armin
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Armin Rigo | 1 Jul 2004 17:44
Favicon

Re: utest conversion tool question

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
(Continue reading)

Terry Reedy | 1 Jul 2004 18:54
Picon
Favicon

PyPy site suggestions

I have a couple of suggestions for the PyPy site, but could not find a
'contact webmaster' link or button, hence this post.

0. Add such to your standard page template.

1. The standard left side bar, under 'sprintinfo', has a link to the
Amsterdam announcement, which in now rather useless, but lacks a link to
the report thereupon,
http://codespeak.net/pipermail/pypy-dev/2003q4/002495.html  which still is
useful.  Suggestion: replace former with latter.

2. The mail archive contains a lot of spam junk.  Example: the previous
message to the one above is a Viagra ad.  The 2003q4 archive listed by
subject had about 45 such junk threads.  Suggestion: delete if possible.
(Yes, given the means to do so, I would help with this by scanning the
lists.)

Terry J. Reedy

_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Terry Reedy | 1 Jul 2004 19:42
Picon
Favicon

Re: utest conversion tool question

Is there any publicly accessible document on utest? the basic design, what
it is about, how it differs from unitest?

Is replacing .assertEquals with assert the main thing?  Are you catching
AssertionError in order to continue with further tests or are you using a
customized test-mode assert?

Looking at the PyPy site, I only found 'New unit testing framework (not
ready yet)' on the Test Design page, a paragraph in the Amsterdam report,
and the current utest threads that began June 15 and which assume
pre-existing knowledge of what utest is.

I am asking because I want to use TDD on a new project, from the beginning,
but I am not especially happy with either doctest or unittest.  (The latter
could work, but the heavy class framework reminds me of why I use Python
instead of Java ;-).

Terry J. Reedy

_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

holger krekel | 1 Jul 2004 19:51
Favicon

Re: Re: utest conversion tool question

Hi Terry, 

[Terry Reedy Thu, Jul 01, 2004 at 01:42:42PM -0400]
> Is there any publicly accessible document on utest? the basic design, what
> it is about, how it differs from unitest?

unfortunately currently not, there only is 

    http://codespeak.net/svn/user/hpk/talks/std-talk.txt

> Is replacing .assertEquals with assert the main thing?  Are you catching
> AssertionError in order to continue with further tests or are you using a
> customized test-mode assert?

We are building AssertionErrors so that they contain detailed 
information about the asertion-expressions. For this, we override 
the builtin-AssertionError but re-interpreting arbitrary exceptions
from the catching-side of std.utest is also possible. 

> Looking at the PyPy site, I only found 'New unit testing framework (not
> ready yet)' on the Test Design page, a paragraph in the Amsterdam report,
> and the current utest threads that began June 15 and which assume
> pre-existing knowledge of what utest is.

Yes, this is a ll more or less outdated, sorry. 

> I am asking because I want to use TDD on a new project, from the beginning,
> but I am not especially happy with either doctest or unittest.  (The latter
> could work, but the heavy class framework reminds me of why I use Python
> instead of Java ;-).
(Continue reading)

Thomas Heller | 1 Jul 2004 20:16
Favicon

Re: utest conversion tool question

"Terry Reedy" <tjreedy <at> udel.edu> writes:

[...]
> I am asking because I want to use TDD on a new project, from the beginning,
> but I am not especially happy with either doctest or unittest.  (The latter
> could work, but the heavy class framework reminds me of why I use Python
> instead of Java ;-).

Reminds me of what Kent Beck writes (test-driven development by example,
Addison-Wesley, page 119):

"""
  xUnit has been ported to more than 30 programming languages as of this
  writing.  Your language is likely to have an implementation already.
  But there are a couple of reasons for implementing xUnit yourself,
  even if there is a version already available:

  * Mastery - The spirit of xUnit is simplicity.  Martin Fowler said,
    "Never in the annals of software engineering was so much owed by so
    many to so few lines of code."  Some of the implementations have
    gotten a little complicated for my taste.  Rolling your own will
    give you a tool over which you have a feeling of mastery.

[...]
"""

Thomas

_______________________________________________
pypy-dev <at> codespeak.net
(Continue reading)

Terry Reedy | 2 Jul 2004 01:28
Picon
Favicon

Re: Re: utest conversion tool question


"holger krekel" <hpk <at> trillke.net> wrote in message
news:20040701175119.GU16751 <at> solar.trillke...

This
>     http://codespeak.net/svn/user/hpk/talks/std-talk.txt

and this
> We are building AssertionErrors so that they contain detailed
> information about the asertion-expressions. For this, we override
> the builtin-AssertionError but re-interpreting arbitrary exceptions
> from the catching-side of std.utest is also possible.

are enough that I can understand this
http://codespeak.net/svn/std/trunk/src/std/ , /magic, /utest

well enough to get ideas for what I need.

===============================================
"Thomas Heller" <theller <at> python.net> wrote in message
news:fz8br3t1.fsf <at> python.net...
> Reminds me of what Kent Beck writes (test-driven development by example,
> Addison-Wesley, page 119):
>
> """
...
>   But there are a couple of reasons for implementing xUnit yourself,
>   even if there is a version already available:
>
>   * Mastery - The spirit of xUnit is simplicity.  Martin Fowler said,
(Continue reading)

Ben Young | 2 Jul 2004 10:11
Favicon

Re: [FW: Re: Patches?]

On Thursday 01 July 2004 16:39, Armin Rigo wrote:
> Hello,
>
> TrivialObjSpace is really not trivial at all.  I believe that ideally it
> should be (1) renamed, (2) no longer the default.  Always run 'py.py -S'
> unless you have a reason not to.
>

I that case you will be happy to know that from this morning pypy runs my 
small test language with no problems. If pypy does end up faster than C I can 
see languages written in Python being themselves faster than Python 
itself! :)

Keep up the good work!

Ben
---

_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Ben Young | 2 Jul 2004 17:44
Favicon

pow and complex object

Hi, 

I found a few weirdities in pos and complex. I tries to fix them by putting 
debugging print statements in complexobject.py in appspace but these did not 
seem to be picked up. Is this the right place to do this or does complex 
exist somewhere else? (All this is in std object space)

pow(2j, 2) => (1+3.4247374308419473e-311j) should be (-4 + 0j)
pow(2j, "fde") => 0j should be type error

Cheers,

Ben
---

_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev


Gmane