polars.testing.parametric.lists#

polars.testing.parametric.lists(
inner_dtype: DataType,
*,
select_from: Sequence[Any] | None = None,
min_size: int = 0,
max_size: int | None = None,
unique: bool = False,
**kwargs: Any,
) SearchStrategy[list[Any]][source]#

Create a strategy for generating lists of the given data type.

Warning

This functionality is currently considered unstable. It may be changed at any point without it being considered a breaking change.

Parameters:
inner_dtype

Data type of the list elements. If the data type is not fully instantiated, defaults will be used, e.g. Datetime will become Datetime('us').

select_from

The values to use for the innermost lists. If set to None (default), the default strategy associated with the innermost data type is used.

min_size

The minimum length of the generated lists.

max_size

The maximum length of the generated lists. If set to None (default), the maximum is set based on min_size: 3 if min_size is zero, otherwise 2 * min_size.

unique

Ensure that the generated lists contain unique values.

**kwargs

Additional arguments that are passed to nested data generation strategies.

Examples