[TIP] Testing for wrong type errors

Fred Drake fdrake at gmail.com
Mon Nov 12 08:34:48 PST 2007

On Nov 12, 2007 11:26 AM, Nate Lowrie <solodex2151 at gmail.com> wrote:
> I am just curious.  Since Python doesn't have explicit type
> declarations, do y'all test for type errors.  For example, if you're

That depends on the contract for the function.  If I want to ensure
errors are handled in a specific way, I'll test for that.  If the
function is performance-sensitive, I'll more often explicitly declare
that the behavior for incorrect parameter types is undefined (in the
docstring or README.txt), and then not test for that.


Fred L. Drake, Jr.    <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller

More information about the testing-in-python mailing list