Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_zlib.BaseCompressTestCase Class Reference
Inheritance diagram for test.test_zlib.BaseCompressTestCase:
Inheritance graph
[legend]
Collaboration diagram for test.test_zlib.BaseCompressTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def check_big_compress_buffer
def check_big_decompress_buffer

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Definition at line 125 of file test_zlib.py.


Member Function Documentation

def test.test_zlib.BaseCompressTestCase.check_big_compress_buffer (   self,
  size,
  compress_func 
)

Definition at line 126 of file test_zlib.py.

00126 
00127     def check_big_compress_buffer(self, size, compress_func):
00128         _1M = 1024 * 1024
00129         fmt = "%%0%dx" % (2 * _1M)
00130         # Generate 10MB worth of random, and expand it by repeating it.
00131         # The assumption is that zlib's memory is not big enough to exploit
00132         # such spread out redundancy.
00133         data = b''.join([random.getrandbits(8 * _1M).to_bytes(_1M, 'little')
00134                         for i in range(10)])
00135         data = data * (size // len(data) + 1)
00136         try:
00137             compress_func(data)
00138         finally:
00139             # Release memory
00140             data = None

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_zlib.BaseCompressTestCase.check_big_decompress_buffer (   self,
  size,
  decompress_func 
)

Definition at line 141 of file test_zlib.py.

00141 
00142     def check_big_decompress_buffer(self, size, decompress_func):
00143         data = b'x' * size
00144         try:
00145             compressed = zlib.compress(data, 1)
00146         finally:
00147             # Release memory
00148             data = None
00149         data = decompress_func(compressed)
00150         # Sanity check
00151         try:
00152             self.assertEqual(len(data), size)
00153             self.assertEqual(len(data.strip(b'x')), 0)
00154         finally:
00155             data = None
00156 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: