constrained_strings#
- polyfactory.value_generators.constrained_strings.handle_constrained_string_or_bytes(random: Random, t_type: Callable[[], T], lower_case: bool = False, upper_case: bool = False, min_length: int | None = None, max_length: int | None = None, pattern: str | Pattern | None = None) T #
Handle constrained string or bytes, for example - pydantic constr or conbytes.
- Parameters:
random – An instance of random.
t_type – A type (str or bytes)
lower_case – Whether to lowercase the result.
upper_case – Whether to uppercase the result.
min_length – A minimum length.
max_length – A maximum length.
pattern – A regex or string pattern.
- Returns:
A value of type T.