The python basic types generators
Returns True or False
>>> result = any_boolean()
>>> type(result)
<type 'bool'>
Return random date from the [from_date, to_date] interval
>>> result = any_date(from_date=date(1990,1,1), to_date=date(1990,1,3))
>>> type(result)
<type 'datetime.date'>
>>> result >= date(1990,1,1) and result <= date(1990,1,3)
True
Return random datetime from the [from_date, to_date] interval
>>> result = any_datetime(from_date=datetime(1990,1,1), to_date=datetime(1990,1,3))
>>> type(result)
<type 'datetime.datetime'>
>>> result >= datetime(1990,1,1) and result <= datetime(1990,1,3)
True
Return random decimal from the [min_value, max_value] interval
>>> result = any_decimal(min_value=0.999, max_value=3, decimal_places=3)
>>> type(result)
<class 'decimal.Decimal'>
>>> result >= Decimal('0.999') and result <= Decimal(3)
True
Returns random float
>>> result = any_float(min_value=0, max_value=100, precision=2)
>>> type(result)
<type 'float'>
>>> result >=0 and result <= 100
True
Return random integer from the selected range
>>> result = any_int(min_value=0, max_value=100)
>>> type(result)
<type 'int'>
>>> result in range(0,101)
True
Return random letter
>>> result = any_letter(letters = ascii_letters)
>>> type(result)
<type 'str'>
>>> len(result)
1
>>> result in ascii_letters
True
Return string with random content
>>> result = any_string(letters = ascii_letters, min_length=3, max_length=100)
>>> type(result)
<type 'str'>
>>> len(result) in range(3,101)
True
>>> any([c in ascii_letters for c in result])
True
Supposes that choices is sequence of two elements items, where first one is the probability and second is the result object or callable
>>> result = weighted_choice([(20,'x'), (100, 'y')])
>>> result in ['x', 'y']
True