Peach :: Generators :: block :: BlockRandomizer :: Class BlockRandomizer
[hide private]

Class BlockRandomizer

source code


This block takes a number of sub-blocks or generators that it will include or not include in variouse combinations and orders.

Instance Methods [hide private]
 
__init__(self, group, okGenerators, notOkGenerators, limit=1024, seed=10312335)
Base constructor, please call me!
source code
 
_resetGenerators(self) source code
 
next(self)
Next value.
source code
 
copyArray(self, array) source code
 
inArray(self, array, item) source code
 
nextTest(self) source code
 
reset(self)
Called to reset the generator to its initial state.
source code
string
getValue(self)
Return data, passed through a transformer if set.
source code
string
getRawValue(self)
Return raw value w/o passing through transformer if set.
source code
number
getSize(self)
Size of generator after all transformations
source code

Inherited from generator.Generator: __iter__, getGroup, getName, getTransformer, identity, setGroup, setName, setTransformer

Method Details [hide private]

__init__(self, group, okGenerators, notOkGenerators, limit=1024, seed=10312335)
(Constructor)

source code 

Base constructor, please call me!

Parameters:
  • group (Group) - Group to perform .next() on
  • okGenerators (Array of Generator objects) - The expected data blocks to mix and match
  • notOkGenerators (Array of Generator objects) - The unexpected data blocks to mix and match
  • limit (Number) - [optional] Limit the number of possible test variations. Defaults to 1024.
  • seed (Number) - [optional] A random number generator is used and can be seeded. Defaults to 10312335.
Overrides: generator.Generator.__init__

next(self)

source code 

Next value. OVERRIDE

From Python docs on next():

The intention of the protocol is that once an iterator's next() method raises StopIteration, it will continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken. (This constraint was added in Python 2.3; in Python 2.2, various iterators are broken according to this rule.)

For Generators, please use the GeneratorCompleted exception instead of StopIteration (its a subclass).

Overrides: generator.Generator.next
(inherited documentation)

reset(self)

source code 

Called to reset the generator to its initial state. OVERRIDE

Overrides: generator.Generator.reset
(inherited documentation)

getValue(self)

source code 

Return data, passed through a transformer if set.

Returns: string
Returns generated data
Overrides: generator.Generator.getValue
(inherited documentation)

getRawValue(self)

source code 

Return raw value w/o passing through transformer if set. OVERRIDE

Returns: string
Data before transformations
Overrides: generator.Generator.getRawValue
(inherited documentation)

getSize(self)

source code 

Size of generator after all transformations

Returns: number
size of data generated