[Tutor] unittesting and nested functions

Christian Meesters cmeesters at ucdavis.edu
Tue Dec 21 15:04:31 CET 2004


> Ken Johnson wrote:
<SNIP>
> This should be
>    self.failUnlessRaises(IOError, DNA, '1 ATG')
>
<SNIP>
> In your usage, you are calling DNA() and passing the result of the 
> call to failUnlessRaises(). The
> call to DNA raises IOError. This happens *before* the call to 
> failUnlessRaises(), so it is
> interpreted as an error.
Ah, I see.
>
> BTW, failUnlessRaises() is implemented using the extended call syntax 
> that came up recently in
> another thread, and it is a good example of why this syntax is useful. 
> It's also interesting that
> the except: statement uses the class that was passed in; I had no idea 
> an except was dynamic in this
> way.
>
Indeed, this is remarkable. Perhaps it's time for me to look into this 
once?

Anyway, thank you Kent, now everything is working just fine.

Everybody a Merry Christmas!
Christian



More information about the Tutor mailing list