def test_imputed_values(self): """ Assert values are as expected""" imputed = complete_case(self.data_m) expected = np.array([[5., 6., 7., 8., 9.], [10., 11., 12., 13., 14.], [15., 16., 17., 18., 19.], [20., 21., 22., 23., 24.]]) self.assertTrue(np.equal(imputed, expected).all())
def test_impute_no_missing_values(self): """ After imputation, no change should occur""" imputed = complete_case(self.data_c) self.assertTrue(np.array_equal(imputed, self.data_c))
def test_impute_missing_values(self): """ After imputation, no NaN's should exist""" imputed = complete_case(self.data_m) self.assertTrue(np.shape(imputed) == (4, 5))
def test_complete_case_(test_data): data = test_data(SHAPE) imputed = complete_case(data) return_na_check(imputed)
def test_return_type(self): """ Check return type, should return an np.ndarray""" imputed = complete_case(self.data_m) self.assertTrue(isinstance(imputed, np.ndarray))
def test_imputed_values(test_data): data = test_data(SHAPE) imputed = complete_case(data) expected = np.arange(5, 25, dtype=float).reshape(4, 5) assert np.equal(imputed, expected).all()
def test_impute_missing_values(test_data): data = test_data(SHAPE) imputed = complete_case(data) assert np.shape(imputed) == (4, 5)
def test_impute_missing_values(): """ After imputation, no NaN's should exist""" imputed = complete_case(data_m) assert np.shape(imputed) == (4, 5)
def test_impute_no_missing_values(): """ After imputation, no change should occur""" imputed = complete_case(data_m) assert not np.isnan(imputed).any()
def test_return_type(): """ Check return type, should return an np.ndarray""" imputed = complete_case(data_m) assert isinstance(imputed, np.ndarray)