[Python-Dev] cpython (merge 3.2 -> default): MERGE: Better test for Issue #15402: Add a __sizeof__ method to struct.Struct

Michael Foord fuzzyman at voidspace.org.uk
Mon Jul 23 21:46:44 CEST 2012


On 23 Jul 2012, at 19:49, Serhiy Storchaka wrote:

> On 23.07.12 19:38, Jesus Cea wrote:
>> The problem is that if we do ">=", then an unpatched python
>> interpreter could pass the test too. So we are not actually testing
>> the feature.
>> 
>> If the repeat counters are going to be optimized, the obvious step
>> would be to upgrade the test to do something like "BHHIL" instead of
>> "123B". I would wait until this feature is implemented to update the test.
>> 
>> What do you think?.
> 
> I think any __sizeof__ tests are meaningless, because any result is implementation detail. For other implementations we get other values and other relations. Any of our a priori assumptions could be incorrect. Even my first assert may fail, if implementation uses a continuous array with overallocation.
> 
> I am now prepared a set of 14 __sizeof__ patches (should it be one issue or 14 individual issues in bugtracker?), and I feel a great desire not to write tests at all.
> 


Without tests how can you have any confidence the patches are correct (or will continue to be correct)? Just because something is implementation dependent doesn't mean it should not be tested - instead the tests should be marked as cpython specific so that they aren't executed on other implementations.

All the best,

Michael

> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
> 


--
http://www.voidspace.org.uk/


May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing 
http://www.sqlite.org/different.html







More information about the Python-Dev mailing list