Message166485
> What if use totalsize = object.__sizeof__(struct_obj) ?
That would defeat the purpose of the test. We want to test whether __sizeof__ is correct, so we shouldn't use __sizeof__ in the test to compute the expected result. I understand that object.__sizeof__ is actually a different implementation, but still: there might be errors e.g. in the type definition that cancel out errors in the sizeof implementation. The more "directly" the expected result is computed, the better.
I also realize that such tests will be fragile if the the structures change. This is a good thing, IMO: anybody changing the layout of some object should *have* to verify that the size computation is still correct, so it's good that the test breaks if the structures change. |
|
Date |
User |
Action |
Args |
2012-07-26 14:41:11 | loewis | set | recipients:
+ loewis, gregory.p.smith, jcea, mark.dickinson, asvetlov, skrah, meador.inge, serhiy.storchaka |
2012-07-26 14:41:11 | loewis | set | messageid: <1343313671.58.0.550720284108.issue15402@psf.upfronthosting.co.za> |
2012-07-26 14:41:11 | loewis | link | issue15402 messages |
2012-07-26 14:41:10 | loewis | create | |
|