dictionary interface

Antoon Pardon apardon at forel.vub.ac.be
Wed Oct 5 05:20:06 EDT 2005


Op 2005-10-05, Paul Rubin schreef <http>:
> Antoon Pardon <apardon at forel.vub.ac.be> writes:
>> But that is contradicted by the unittest. If you have a unittest for
>> comparing dictionaries, that means comparing dictionaries has a
>> testable characteristic and thus is further defined.
>
> No, I don't think so.  The unittest makes sure that a particular
> implementation works as intended.  That doesn't mean that every part
> of the of how that particular implementation works is required by the
> language definition.

As far as I understand, unittest test for functionality clients should
be able to rely on. They shouldn't be used to test a specific
implementation feature.

The idea is that if you change the implementation, you can quickly
test the functionality is unharmed. But you can't do that if
also specific implementation details are tested for.

> It can have some non-required (but
> non-forbidden) characteristics and those could still get tested.

That doesn't seem to make sense. If it is not required it shouldn't
be tested for, at least not in a unittest, because otherwise a new
implementation that doesn't have the non-required characteristics
will be rejected.

My tree class is almost finished, but one unittest still fails,
is this a failing of my class (as a replacement for a dictionary)
or is this a non-required characteristic of dictionaries?

-- 
Antoon Pardon



More information about the Python-list mailing list