Skip to content

Commit

Permalink
Merge pull request #6544 from ales-erjavec/fixes/owpredictions-reg-error
Browse files Browse the repository at this point in the history
owpredictions: Fix an exception when switching regression error in gui
  • Loading branch information
janezd authored Aug 25, 2023
2 parents bb5e845 + d2ec951 commit ca5bac8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Orange/widgets/evaluate/owpredictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ def _update_control_visibility(self):
self.score_opt_box.setVisible(bool(self.class_var))

def _reg_error_changed(self):
self.predictionsview.model().setRegErrorType(self.show_reg_errors)
model = self.predictionsview.model()
if model is not None:
model.setRegErrorType(self.show_reg_errors)
self._update_prediction_delegate()

def _update_errors_visibility(self):
Expand Down
7 changes: 7 additions & 0 deletions Orange/widgets/evaluate/tests/test_owpredictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,13 @@ def get_delegate() -> Optional[RegressionErrorDelegate]:
self.assertEqual(delegate.span, max(3 / 2, 6 / 11))
self.assertFalse(delegate.centered)

def test_regression_error_no_model(self):
data = self.housing[:5]
self.send_signal(self.widget.Inputs.data, data)
combo = self.widget.controls.show_reg_errors
with excepthook_catch(raise_on_exit=True):
simulate.combobox_activate_index(combo, 1)

def test_report(self):
widget = self.widget

Expand Down

0 comments on commit ca5bac8

Please sign in to comment.