|
Peach ::
Generators ::
dictionary ::
GeneratorListGroupMaster ::
Class GeneratorListGroupMaster
|
|
Class GeneratorListGroupMaster
source code
Provides a mechanism to create in effect a group of GeneratorList2's
that will progress and increment together drivin by the master of the
group. This Generator is the Group Master generator and controls the
slaves of the group.
This generator comes in handy when you have two bits of data that are
logically linked but in separate places. An example would be a length of
data being generated. Both values are parameters and generated
separaetly but a test calls for performing different length tests against
different data being generated (zero length data and 100 bytes of data
say) which would be a subset of the noramally generated data.
Example:
>>> groupNormalBlock = Group()
>>> groupForeachBlock = Group()
>>> groupDoLength = Group()
>>> groupForeachBlockDoLength = GroupForeachDo(groupForeachBlock, groupDoLength)
>>>
>>> genBlock = GeneratorListGroupMaster(None, [
... groupNormalBlock,
... groupForeachBlockDoLength
... ], [
...
...
... GeneratorList(groupNormalBlock, [
... Static('A'),
... Static('BB'),
... ]),
...
...
... GeneratorList(groupForeachBlock, [
... Static(''),
... Static('PEACH' * 10),
... ]),
... ])
>>>
>>> genLength = GeneratorListGroupSlave([
... None,
... None,
... ], [
...
... BlockSize(genBlock),
...
...
... GeneratorList(groupDoLength, [
... NumberVariance(None, BlockSize(genBlock), 20),
... BadNumbers(),
... ])
... ], genBlock)
>>>
>>> print genBlock.getValue()
A
>>> print genLength.getValue()
1
>>> genBlock.next()
>>> print genBlock.getValue()
BB
>>> print genLength.getValue()
2
>>> genBlock.next()
>>> print genBlock.getValue()
>>> print genLength.getValue()
-20
|
|
__init__(self,
group,
groupList,
list,
slaves=None,
name=None)
Base constructor, please call me! |
source code
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from GeneratorList2:
setGroups
Inherited from GeneratorList:
getList,
getRawValue,
setList
Inherited from generator.Generator:
__iter__,
getGroup,
getName,
getTransformer,
getValue,
identity,
setGroup,
setName,
setTransformer
|
|
|
_slaves = []
|
|
|
_completed = False
|
__init__(self,
group,
groupList,
list,
slaves=None,
name=None)
(Constructor)
| source code
|
Base constructor, please call me!
- Parameters:
group (Group) - Group this Generator belongs to
groupList (list) - List of Groups to use on generators
list (list) - List of Generators to iterate through
name (String) - [optional] Name for this Generator. Used for debugging.
- Overrides:
generator.Generator.__init__
|
|
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)
|