Test cases and static typing

ketil+news at ii.uib.no ketil+news at ii.uib.no
Fri Oct 24 16:43:12 EDT 2003


Pascal Costanza <costanza at web.de> writes:

> Dirk Thierbach wrote:

>>> testxyz obj = (concretemethod obj == 42)

>> Does the code compile as long as concretemethod doesn't exist?
>> No. Does your test pass as long as conretemthod doesn't exist? It
>> doesn't, for the same reason.

> As long as I am writing only tests, I don't care. When I am in the
> mood of writing tests, I want to write as many tests as possible,
> without having to think about whether my code is acceptable for the
> static type checker or not.

Uh...the type system will let you *write* what you want, it will just
stop you from *running* those tests.  Which are obviously going to
fail anyway.  Okay, so perhaps you for some reason needs to write the
tests for nonexistent code, and then run something else that you keep
in the same file.  You then need to add

        concretemethod = undefined

which just goes to show you how useless static typing is.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants




More information about the Python-list mailing list