Skip to content

Commit 76926b9

Browse files
authored
Merge pull request #46 from UBC-MDS/scale-tests-add
Fix tests
2 parents 7e45172 + 9ab91f8 commit 76926b9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tests/test_eda_utils_py.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ def test_cor_map():
173173

174174

175175
def test_scaler():
176+
data = pd.DataFrame(
177+
{
178+
"SepalLengthCm": [5.1, 4.9, 4.7],
179+
"SepalWidthCm": [1.4, 1.4, 1.3],
180+
"PetalWidthCm": [0.2, 0.1, 0.2],
181+
"Species": ["Iris-setosa", "Iris-virginica", "Iris-germanica"],
182+
}
183+
)
176184
mock_df_1 = pd.DataFrame(
177185
{"col1": [1, 0, 0, 3, 4], "col2": [4, 1, 1, 0, 1], "col3": [2, 0, 0, 2, 1]}
178186
)
@@ -227,19 +235,22 @@ def test_scaler():
227235

228236
# Test if the imput is not dataFrame
229237
with raises(TypeError):
230-
eda_utils_py.scale("A string")
238+
eda_utils_py.scale("A string", ['one', 'two'])
231239

232240
# Tests if contents of columns is not of type str
233241
with raises(TypeError):
234-
eda_utils_py.scale(mock_df_1, (1, 2, 3, 4))
242+
eda_utils_py.scale(mock_df_1, [1, 2, 3, 4])
243+
244+
with raises(TypeError):
245+
eda_utils_py.scale(mock_df_1, [None])
235246

236247
# Tests if columns do not exist in the dataframe
237248
with raises(Exception):
238249
eda_utils_py.scale(mock_df_1, ['one', 'two'])
239250

240251
# Tests if if not all columns in columns are numeric
241252
with raises(Exception):
242-
eda_utils_py.scale(mock_df_1, {'col1': "1", 'col2': "3"})
253+
eda_utils_py.scale(data, ['Species'])
243254

244255
# Tests whether data is not of type pd.Dataframe raises TypeError
245256
with raises(TypeError):

0 commit comments

Comments
 (0)