Generators

generators Module

Data set generators.

impyccable.generators.Boolean()

Returns a generator that endlessly returns random True or False values.

impyccable.generators.Choice(choices)

Returns a generator that will endlessly spew out a random choice.

impyccable.generators.Dictionary(gendict)

Returns a generator that endlessly yields dictionaries with the given keys and values derived from a dictionary of value generators.

impyccable.generators.Float(least=-10000000.0, most=10000000.0)

Returns a generator that endlessly returns random floats >= lest and <= most.

impyccable.generators.Function(val)

Returns a generator that will call a function and endlessly yield the return value.

impyccable.generators.Integer(least=-9223372036854775808, most=9223372036854775807)

Returns a generator that endlessly returns random integers >= lest and <= most.

impyccable.generators.List(element, least=1, most=30)

Returns a generator that yields random lists from the given element generator. Lists can be given a upper and lower bound length.

impyccable.generators.String(least=0, most=30, valid='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+, -./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c')

Returns a generator that will endlessly pump out random strings of a length >= least and <= most, constiting of strings/chars from the valid selection.

The valid argument should be a list of string or a string of characters and defaults to all printable characters as defined in string.printable.

impyccable.generators.Tuple(*args)

Returns a generator that yields random tuples of the given element generator of the given length.

Arguments defined after the length are assumed to be generators used for values to store in the returned tuples.

impyccable.generators.Typer(arg)

Typer is designed to take a data description and turn it into an Impyccable compatable generator.

Any form of python generator will be returned including Impyccable generators and are expected to be able to yield an arbitrary amount of values. If the given argument is a value it will be wrapped in an Impyccable Value generator. If the argument is callable then it will be wrapped in a Function generator. Finally if the argument is a basic type (str, int, float, bool) then it will return the default Impyccable generators for those types.

This function is used internally by the Impyccable runners and is not designed for standalone usage.

impyccable.generators.Value(val)

Returns a generator that will endlessly spew out the same value.

impyccable.generators.Words(leastchar=1, mostchar=30, leastwords=0, mostwords=30, valid='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+, -./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c')

Returns a generator that puts together a string of “words” made of valid characters. This works very similar to the String generator but every so many characters a space is inserted and a new word started for a random amount of words.

Project Versions

Table Of Contents

Previous topic

Runners

Next topic

Changelog

This Page