design by contract versus doctest

aku aku at europe.com
Mon Apr 5 12:48:27 EDT 2004


On 2004-04-05, Peter Hansen <peter at engcorp.com> wrote:
>  aku wrote:
> 
> > Isn't it so, that by applying DBC, a lot of unittests can be
> > made redundant?
> 
>  How would you propose verifying that your code will work if you
>  don't run tests before you ship?

in debugging mode you obviously have to ensure that the caller
makes sure that all preconditions are met...then - by contract - 
the postconditions are met on returning from the function.
A very very simple example, but just to make the point:

n = 1
# at this point we are sure that n is an integer and n>=0
result = sort(n)

> 
>  Don't say "manual testing"...
> 
>  -Peter



More information about the Python-list mailing list