|
4 | 4 | import altair as alt |
5 | 5 | from pandas.api.types import is_numeric_dtype |
6 | 6 | import numpy as np |
7 | | - |
| 7 | +from pytest import raises |
8 | 8 |
|
9 | 9 | def test_version(): |
10 | 10 | assert __version__ == '0.1.0' |
@@ -49,34 +49,34 @@ def test_outlier_identifier(): |
49 | 49 | }) |
50 | 50 |
|
51 | 51 | # Test if the imput is not dataFrame |
52 | | - with raise(TypeError): |
| 52 | + with raises(TypeError): |
53 | 53 | eda_utils_py.outlier_identifier("not dataframe") |
54 | 54 |
|
55 | 55 | # Test if columns input is not list |
56 | | - with raise(TypeError): |
| 56 | + with raises(TypeError): |
57 | 57 | eda_utils_py.outlier_identifier(test_df, columns=2) |
58 | 58 |
|
59 | 59 | # Test if input column list is in the dataframe |
60 | | - with raise(TypeError): |
| 60 | + with raises(Exception): |
61 | 61 | eda_utils_py.outlier_identifier(test_df, columns=["not in"]) |
62 | 62 |
|
63 | 63 | # Test if method input is not one of three methods provided |
64 | | - with raise(TypeError): |
| 64 | + with raises(Exception): |
65 | 65 | eda_utils_py.outlier_identifier(test_df, columns=["SepalLengthCm"], method = "no") |
66 | 66 |
|
67 | 67 | # Test if column selected included non-numeric columns |
68 | | - with raise(Exception): |
| 68 | + with raises(Exception): |
69 | 69 | eda_utils_py.outlier_identifier(test_df, columns=["Species"]) |
70 | 70 |
|
71 | 71 | assert pd.DataFrame.equals( |
72 | | - outlier_identifier(test_df, test_column), trim_output |
| 72 | + eda_utils_py.outlier_identifier(test_df, test_column), trim_output |
73 | 73 | ), "Default test not pass" |
74 | 74 | assert pd.DataFrame.equals( |
75 | | - outlier_identifier(test_df, test_column,method = "median"), median_output |
| 75 | + eda_utils_py.outlier_identifier(test_df, test_column,method = "median"), median_output |
76 | 76 | ), "The median method is not correct" |
77 | 77 | assert pd.DataFrame.equals( |
78 | | - outlier_identifier(test_df, test_column, method = "mean"), mean_output |
| 78 | + eda_utils_py.outlier_identifier(test_df, test_column, method = "mean"), mean_output |
79 | 79 | ), "The mean method is not correct" |
80 | 80 | assert pd.DataFrame.equals( |
81 | | - outlier_identifier(test_df, columns = ["SepalLengthCm"], method = "mean"), column_output |
| 81 | + eda_utils_py.outlier_identifier(test_df, columns = ["SepalLengthCm"], method = "mean"), column_output |
82 | 82 | ), "The selected column method is not correct" |
0 commit comments