Example #1
0
 def test_custom_handler(self):
     class MyContainer(object):
         def items(self):
             for i in xrange(3):
                 yield i
     container = MyContainer()
     self.assertGreater(total_size(container, {MyContainer: MyContainer.items}), 0)
Example #2
0
 def test_positivity(self):
     for Class in [int, float, long, complex, str, unicode, list, tuple, bytearray, ]:
         r = Class()
         self.assertGreater(total_size(r), 0)
Example #3
0
 def test_mem_growing(self):
     string = ''
     size = total_size(string)
     string = '*' * int(1e6)
     new_size = total_size(string)
     self.assertGreater(new_size, size)
Example #4
0
 def test_mem_growing(self):
     string = ''
     size = total_size(string)
     string = '*' * int(1e6)
     new_size = total_size(string)
     assert new_size > size