Example #1
0
 def test_add_3(self):
     """
     Unit test add 3
     """
     xpl = SmartExplainer()
     xpl.columns_dict = {0: 'Age', 1: 'Education', 2: 'Sex'}
     xpl.add(features_dict={'Age': 'Age (Years Old)'})
     assert xpl.features_dict['Age'] == 'Age (Years Old)'
     assert xpl.features_dict['Education'] == 'Education'
Example #2
0
 def test_add_2(self):
     """
     Unit test add 2
     """
     xpl = SmartExplainer()
     xpl._classes = [0, 1]
     xpl._case = "classification"
     xpl.add(label_dict={0: 'Zero', 1: 'One'})
     assert xpl.label_dict[0] == 'Zero'
     assert xpl.label_dict[1] == 'One'
Example #3
0
 def test_add_1(self, mock_check_y_pred):
     """
     Unit test add 1
     Parameters
     ----------
     mock_check_y_pred : [type]
         [description]
     """
     xpl = SmartExplainer()
     dataframe_yp = pd.DataFrame([1, 3, 1], columns=['pred'], index=[0, 1, 2])
     mock_y_pred = Mock(return_value=dataframe_yp)
     mock_check_y_pred.return_value = mock_y_pred()
     xpl.x_pred = dataframe_yp
     xpl.add(y_pred=dataframe_yp)
     expected = SmartExplainer()
     expected.y_pred = dataframe_yp
     assert not pd.testing.assert_frame_equal(xpl.y_pred, expected.y_pred)
     mock_check_y_pred.assert_called()