Re: Debugging Python

From: Frithiof Andreas Jensen (frithiof.jensen_at_removethis.ted.ericsson.dk)
Date: 01/13/04


Date: Tue, 13 Jan 2004 10:48:13 +0100


"Peter Hansen" <peter@engcorp.com> wrote in message
news:4002AE9B.C51448FB@engcorp.com...

> ...., as it takes me only about twenty seconds to start a
> new test file and that's *without* using a template.

....in twenty seconds you can just about write "import unittest" ;-)

I find that a simple module will need about three to five tests for each
method in each class and probably some test data as well often yielding in
total *more* lines of test code than the module I want to test.

It is simple, stupid & boring code but still lines that have to be typed and
debugged.

*That* is tedious work. Always will be.

The benefit comes later - when improving and extending the module one can
immediately see if it breaks and also I find that if one cannot think of an
obvious way of testing some class/method/unit it is usually because the
interface is stupid and needs a redesign.

The real fun with unittest starts when using "other peoples code": I wrote
an accounts database module based on pySqlite for a horse racing program I
am (still!) writing for fun. That was not at all easy to get to run in such
a way as one could test the database functions properly with unittest. There
is a lot of massaging of data to test that the queries work as intended and
manual work to design SQL data that will yield simple tests.

OTOH I am pretty confident the implementation actually works and I even
think I understand the kinks in pySqlite's implementation of the python
database API too ;-).



Relevant Pages

  • Re: Win XP Search not finding anything!
    ... OK, now I fell stupid! ... Also note that stupid searching in previous versions of windows does not ... I use a script that searches for unicode or ansi text. ... >>> I was trying to find a form in an Access database that had code I ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: C64 DTV PAL questions for a newbie please
    ... > in microcomputer programming and networking from a widely accredited ... so i had to do every kind of work including coding database ... Any job is never stupid when money is needed. ...
    (comp.sys.cbm)
  • Re: More Vista Woes
    ... our logging and database applications where data isn't fully log ect. ... Peach Tree database seems to ring a bell as one of the troubled areas ... Being the idiot that you are, I would say that you are so stupid, you ... Hire a REAL database guru, and PORT your stupid accounting mistake ...
    (sci.electronics.design)
  • Re: Win XP Search not finding anything!
    ... Ask stupid people like yourself. ... > This is not smart searching, it's really, really stupid! ... >> I was trying to find a form in an Access database that had code I wanted ... So using Windows XP I did a search on all of my databases on the ...
    (microsoft.public.windowsxp.help_and_support)
  • Global.asax.cs and unittests
    ... In the global file, i load some data from a Oracle table and save it in ... The following unittest show the beginning of the method, where the database ... If this mock isn't created, the unittest will try to access ...
    (microsoft.public.dotnet.framework.aspnet)