How to detect typos in Python programs
Richard
rshaw2 at midsouth.rr.com
Fri Jul 25 14:36:23 EDT 2003
Manish Jethani <manish.j at gmx.net> wrote in message news:<ZPaUa.6$gZ.133 at news.oracle.com>...
> Hi all,
>
> Is there a way to detect typos in a Python program, before
> actually having to run it. Let's say I have a function like this:
>
> def server_closed_connection():
> session.abost()
>
> Here, abort() is actually misspelt. The only time my program
> follows this path is when the server disconnects from its
> end--and that's like once in 100 sessions. So sometimes I
> release the program, people start using it, and then someone
> reports this typo after 4-5 days of the release (though it's
> trivial to fix manually at the user's end, or I can give a patch).
>
> How can we detect these kinds of errors at development time?
> It's not practical for me to have a test script that can make
> the program go through all (most) the possible code paths.
>
> -Manish
Two words! Unit Testing!
Just do a google search on "Python unit testing" and I'm sure you'll
get more information than you ever wanted to know.
Richard
More information about the Python-list
mailing list