On 4/25/07, Greg Ewing <[EMAIL PROTECTED]> wrote:
Emin.shopper Martinian.shopper wrote: > If you believe that there exist data structures or algorithms where a > meaningful unit test takes many minutes or hours, I wouldn't be worried about spending minutes to save hours later.
OK, but I would rather not have to spend 10 minutes waiting for a unit test each time I edit a file when I can easily have the test done in seconds at import time. As for unit tests taking hours -- I'm skeptical. Do you
know of algorithms that it's provably impossible to test without it taking hours?
Imagine you have to query a database and do something with the resulting data. Or imagine some complicated network interaction among p2p clients. Or imagine numerical simulation over a very fine mesh. I've worked on all of these and the unit-tests can easily take long enough that you don't want to run them every time you make any changes. Thirdly -- your program can *still* fail after many hours
due to one of the many things your static checks don't and can't cover.
Of course. I'm not saying ABCs will solve all bugs. What I am saying is that ABCs provide an easy way to catch simple bugs that can sometimes save you a lot of time. Sure you could produce fake data for input to your unit-tests or otherwise contrive things so that you have very quick unit-tests that really only check if things have the right methods. But if you want a quick check that derived classes implement the right methods, I think ABCs are a good solution. At least, they're a solution I find useful. I'm not trying to advocate that you should use them only that they should be available. -Emin
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com