detecting containers during object introspection

Steven Taschuk staschuk at
Tue Jul 22 12:30:37 CEST 2003

Quoth David C. Fox:
> However, the real problem occurs if the developer makes a change like 
> this (or even just adds a new attribute which is a non-standard 
> container), and does increment the version number.  Because the version 
> number was incremented, the regression test would *expect* some of the 
> dictionary elements to change type or structure, and would simply update 
> the standard example dictionary.  Then, any *subsequent* changes to the 
> structure of the values in that container would go undetected (unless 
> the developer had also updated the recursive comparison operation to 
> take into account that the unknown object was a container).

Yes, I see.  Thorny.

What if your recursive comparison operation choked on values of
unknown types rather than falling back on the weak "have same
type" criterion?  That way, the developer who changes the
structure by introducing values of (e.g.) a new dict work-alike
type would see tests fail, which would remind her to add to that
comparison operation the necessary knowledge of the new type.

Fail safe, in other words, where "safe" means "no false positives
from the regression test".

Steven Taschuk                                                   w_w
staschuk at                                      ,-= U
                                                               1 1

More information about the Python-list mailing list