isA function?

Delaney, Timothy tdelaney at avaya.com
Sun Jul 14 19:48:46 EDT 2002


> From: Roy Smith [mailto:roy at panix.com]
> 
> Still, I think it's a reasonable thing to do in a unit test 
> environment.  

What would be more useful though is to simply try to use the functionality.
If it works, why is there a need for it to be a particular type? If an
attribute is missing, the unit test will fail. If the semantics are wrong,
and it passes, the unit test needs an additional case added.

I actually think that (in Python at least) asserting that something is a
particular type in a unit test is probably the *worst* place to do it. If
you just rely on behaviour in the unit test, you can point to the test and
say "anything that passes this (fulfils the contract) is acceptable".

Tim Delaney





More information about the Python-list mailing list