primitives#
- polyfactory.value_generators.primitives.create_random_float(random: Random, minimum: Decimal | float | None = None, maximum: Decimal | float | None = None) float #
Generate a random float given the constraints.
- Parameters:
random – An instance of random.
minimum – A minimum value
maximum – A maximum value.
- Returns:
A random float.
- polyfactory.value_generators.primitives.create_random_integer(random: Random, minimum: int | None = None, maximum: int | None = None) int #
Generate a random int given the constraints.
- Parameters:
random – An instance of random.
minimum – A minimum value
maximum – A maximum value.
- Returns:
A random integer.
- polyfactory.value_generators.primitives.create_random_decimal(random: Random, minimum: Decimal | None = None, maximum: Decimal | None = None) Decimal #
Generate a random Decimal given the constraints.
- Parameters:
random – An instance of random.
minimum – A minimum value
maximum – A maximum value.
- Returns:
A random decimal.
- polyfactory.value_generators.primitives.create_random_bytes(random: Random, min_length: int | None = None, max_length: int | None = None, lower_case: bool = False, upper_case: bool = False) bytes #
Generate a random bytes given the constraints.
- Parameters:
random – An instance of random.
min_length – A minimum length.
max_length – A maximum length.
lower_case – Whether to lowercase the result.
upper_case – Whether to uppercase the result.
- Returns:
A random byte-string.
- polyfactory.value_generators.primitives.create_random_string(random: Random, min_length: int | None = None, max_length: int | None = None, lower_case: bool = False, upper_case: bool = False) str #
Generate a random string given the constraints.
- Parameters:
random – An instance of random.
min_length – A minimum length.
max_length – A maximum length.
lower_case – Whether to lowercase the result.
upper_case – Whether to uppercase the result.
- Returns:
A random string.