mirror of https://github.com/python/cpython
Better test for Issue #15402: Add a __sizeof__ method to struct.Struct
This commit is contained in:
parent
b14d8c9bcf
commit
189fdf187b
|
@ -204,6 +204,7 @@ docs@python.org), and we'll be glad to correct the problem.
|
||||||
* Anthony Starks
|
* Anthony Starks
|
||||||
* Greg Stein
|
* Greg Stein
|
||||||
* Peter Stoehr
|
* Peter Stoehr
|
||||||
|
* Serhiy Storchaka
|
||||||
* Mark Summerfield
|
* Mark Summerfield
|
||||||
* Reuben Sumner
|
* Reuben Sumner
|
||||||
* Kalle Svensson
|
* Kalle Svensson
|
||||||
|
|
|
@ -559,12 +559,12 @@ class StructTest(unittest.TestCase):
|
||||||
def test_sizeof(self):
|
def test_sizeof(self):
|
||||||
self.assertGreater(sys.getsizeof(struct.Struct('BHILfdspP')),
|
self.assertGreater(sys.getsizeof(struct.Struct('BHILfdspP')),
|
||||||
sys.getsizeof(struct.Struct('B')))
|
sys.getsizeof(struct.Struct('B')))
|
||||||
self.assertGreaterEqual(sys.getsizeof(struct.Struct('123B')),
|
self.assertGreater(sys.getsizeof(struct.Struct('123B')),
|
||||||
sys.getsizeof(struct.Struct('B')))
|
sys.getsizeof(struct.Struct('B')))
|
||||||
self.assertGreaterEqual(sys.getsizeof(struct.Struct('B' * 123)),
|
self.assertGreater(sys.getsizeof(struct.Struct('B' * 1234)),
|
||||||
|
sys.getsizeof(struct.Struct('123B')))
|
||||||
|
self.assertGreater(sys.getsizeof(struct.Struct('1234B')),
|
||||||
sys.getsizeof(struct.Struct('123B')))
|
sys.getsizeof(struct.Struct('123B')))
|
||||||
self.assertGreaterEqual(sys.getsizeof(struct.Struct('123xB')),
|
|
||||||
sys.getsizeof(struct.Struct('B')))
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
run_unittest(StructTest)
|
run_unittest(StructTest)
|
||||||
|
|
Loading…
Reference in New Issue