On 4/19/02 12:07 PM, "Jeffrey P Shell" <[EMAIL PROTECTED]> wrote:
> def somemethod(self, num):
>  assert type(num) is type(1.0)   # assert it's a float
>  return num + 3.3
> 
> self.failUnlessRaises(AssertionError, somemethod, 42)
> 
> The above would raise an AssertionError if somemethod *didn't* raise an
> AssertionError, which can lead to a little brain meltdown.  Furthermore, if
> you were just testing this:
> 
> self.failUnlessEqual(somemethod(42), 43.3)
> 
> Or, also:
> 
> assert somemethod(42) == 43.3

Naturally, I meant to be testing the result to be equal to 45.3 here ;).
0xDECAFBAD

-- 
Jeffrey P Shell 
www.cuemedia.com



_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to