Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_zlib Namespace Reference

Classes

class  ChecksumTestCase
class  ChecksumBigBufferTestCase
class  ExceptionTestCase
class  BaseCompressTestCase
class  CompressTestCase
class  CompressObjectTestCase

Functions

def genblock
def choose_lines
def test_main

Variables

tuple zlib = support.import_module('zlib')
 mmap = None
string HAMLET_SCENE

Function Documentation

def test.test_zlib.choose_lines (   source,
  number,
  seed = None,
  generator = random 
)
Return a list of number lines randomly chosen from the source

Definition at line 554 of file test_zlib.py.

00554 
00555 def choose_lines(source, number, seed=None, generator=random):
00556     """Return a list of number lines randomly chosen from the source"""
00557     if seed is not None:
00558         generator.seed(seed)
00559     sources = source.split('\n')
00560     return [generator.choice(sources) for n in range(number)]
00561 
00562 

def test.test_zlib.genblock (   seed,
  length,
  step = 1024,
  generator = random 
)
length-byte stream of random data from a seed (in step-byte blocks).

Definition at line 540 of file test_zlib.py.

00540 
00541 def genblock(seed, length, step=1024, generator=random):
00542     """length-byte stream of random data from a seed (in step-byte blocks)."""
00543     if seed is not None:
00544         generator.seed(seed)
00545     randint = generator.randint
00546     if length < step or step < 2:
00547         step = length
00548     blocks = bytes()
00549     for i in range(0, length, step):
00550         blocks += bytes(randint(0, 255) for x in range(step))
00551     return blocks
00552 
00553 

Here is the caller graph for this function:

Definition at line 628 of file test_zlib.py.

00628 
00629 def test_main():
00630     support.run_unittest(
00631         ChecksumTestCase,
00632         ChecksumBigBufferTestCase,
00633         ExceptionTestCase,
00634         CompressTestCase,
00635         CompressObjectTestCase
00636     )


Variable Documentation

Definition at line 563 of file test_zlib.py.

Definition at line 13 of file test_zlib.py.

Definition at line 8 of file test_zlib.py.