test_utils
Tests for utils module.
duplicate_data(spark)
¶
Fixture to provide data with duplicates. Args: spark (SparkSession): Spark session object. Returns: DataFrame: Spark DataFrame object.
Source code in code\tests\test_utils.py
sample_data(spark)
¶
Fixture to provide sample data for testing. Args: spark (SparkSession): Spark session object.
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
Spark DataFrame object. |
Source code in code\tests\test_utils.py
test_column_not_unique(duplicate_data)
¶
Test that a ValueError is raised for non-unique columns.
test_columns_unique_all_unique(sample_data)
¶
Test that no error is raised when all columns are unique.
Source code in code\tests\test_utils.py
test_create_spark_session()
¶
Test create_spark_session function.
Source code in code\tests\test_utils.py
test_empty_column_list(sample_data)
¶
Test behavior when the column list is empty.
test_mask_sensitive_columns(spark, sample_data)
¶
Test masking of sensitive columns.
Source code in code\tests\test_utils.py
test_mask_sensitive_columns_missing_column(sample_data)
¶
Test that a ValueError is raised if a sensitive column is not present in the DataFrame.
Source code in code\tests\test_utils.py
test_mask_sensitive_columns_with_null_values(sample_data)
¶
Test that null values in sensitive columns are not masked.
Source code in code\tests\test_utils.py
test_missing_column(sample_data)
¶
Test that a ValueError is raised for missing columns.
Source code in code\tests\test_utils.py
test_multiple_columns_mixed(duplicate_data)
¶
Test a combination of valid and invalid column uniqueness.
test_read_csv_file_with_inferred_schema(spark)
¶
Test read_csv_file function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spark
|
SparkSession
|
Spark session object. |
required |
Source code in code\tests\test_utils.py
test_read_csv_file_with_specified_schema(spark)
¶
Test read_csv_file function with specified schema.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spark
|
SparkSession
|
Spark session object. |
required |