snowflake.hypothesis_snowpark.dataframe_strategy¶
- snowflake.hypothesis_snowpark.dataframe_strategy(schema: str | DataFrameSchema, session: Session, size: int | None = None) SearchStrategy[DataFrame]¶
Create a Hypothesis strategy for generating Snowpark DataFrames based on a given schema.
- Parameters:
schema – A schema defining the columns, data types and checks that the generated DataFrame should satisfy. This can be a path to a JSON schema file generated by the
snowflake.snowpark_checkpoints_collector.collect_dataframe_checkpoint()function when the collection mode is set to SCHEMA, or a Pandera DataFrameSchema object.session – The Snowpark session to use for creating the DataFrames.
size – The number of rows to generate for each DataFrame. If not specified, the strategy will generate DataFrames of different sizes.
Examples
Generate a Snowpark DataFrame from a JSON schema file:
Generate a Snowpark DataFrame from a Pandera DataFrameSchema object:
You can control aspects like the maximum number of test cases, the deadline for each test execution, verbosity levels and many others using the Hypothesis @settings decorator.
- Returns:
A Hypothesis strategy that generates Snowpark DataFrames.