[Python-Dev] cpython (merge 3.2 -> default): MERGE: Better test for Issue #15402: Add a __sizeof__ method to struct.Struct
Serhiy Storchaka
storchaka at gmail.com
Mon Jul 23 20:49:56 CEST 2012
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.
More information about the Python-Dev
mailing list