def test_file_is_created(self): tests = [] path = '/test/training.csv' data = data_preprocessing.read_dataset(path, num_pages=1) tests.append(True if os.path.exists(path) else False) tests.append(True if type(data) is type(np.array([])) else False) os.remove(path) self.assertTrue(all(tests))
def test_file_loads(self): data = data_preprocessing.read_dataset() self.assertEqual(type(data), type(np.array([])))
def test_csv_has_two_columns(self): data = data_preprocessing.read_dataset() self.assertEqual(data.shape[1], 2)
def test_loading_file_raises_runtime_error(self): with self.assertRaises(RuntimeError): data_preprocessing.read_dataset( dataset='/some/file/that/doesnt/exist', on_error='raise')
def read_dataset(): # Read X, Y from dataset dataset, X, y = dp.read_dataset( 'ann/customer_churn_modelling/Churn_modelling.csv') X = X[:, 3:13] return dataset, X, y