-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUnitTests.py
More file actions
30 lines (22 loc) · 1002 Bytes
/
UnitTests.py
File metadata and controls
30 lines (22 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest
from os import path
import pandas as pd
class UnitTests(unittest.TestCase):
# Testing for the existing of the heart data set
def test_df_import(self):
self.assertTrue(path.exists('Datasets/IMDb_movies.csv'))
#Testing if nan exists in the data set
def test_if_nan_exist(self):
df = pd.read_csv(r"Datasets/IMDb_movies.csv", low_memory=False)
for i in df.columns:
self.assertFalse(df[i].isnull().values.any())
#Test if non-numeric values exist in the dataframe
def test_if_non_numeric_exists(self):
df = pd.read_csv(r"Datasets/IMDb_movies.csv", low_memory=False)
for i in df.columns:
self.assertEqual(str(df[i].dtypes), 'int64' or 'float64')
# Testing for the existing of the parson heatmap
def test_mlr(self):
self.assertTrue(path.exists('assets/pearson_heatmap.png'))
if __name__ == 'main':
unittest.main()