The transform_num() function is designed to perform various transformations on numerical data within a DataFrame, such as standardization, normalization, quantile transformation, and more. The tests aim to ensure the function can handle different types of data inputs correctly and respond appropriately to erroneous situations.
Summary of Unit Tests for
transform_num()
The
transform_num()
function is designed to perform various transformations on numerical data within a DataFrame, such as standardization, normalization, quantile transformation, and more. The tests aim to ensure the function can handle different types of data inputs correctly and respond appropriately to erroneous situations.Detailed Breakdown of Tests*
* The full test suite can be accessed here.
Error-Handling Tests
These tests are designed to ensure that
transform_num()
correctly identifies and handles incorrect inputs and scenarios:Non-DataFrame Input:
TypeError
is raised when the input is not a DataFrame.Non-List Numerical Variables:
TypeError
ifnumerical_variables
is not provided as a list.Invalid Numerical Variable Entries:
TypeError
is raised for non-string entries in thenumerical_variables
list.Empty DataFrame:
ValueError
is raised when the DataFrame is empty.Nonexistent Numerical Variable:
ValueError
is raised if the specified numerical variable does not exist in the DataFrame.Invalid Quantile Parameters:
Invalid Interaction Pairs Format:
TypeError
when the format of interaction pairs is incorrect.Functionality Tests
These tests ensure that each transformation method is applied correctly and yields expected results:
Standardize:
Log Transformation:
Normalize:
Quantile Transformation:
Robust Scaling: