Skip to content

Commit 1895c41

Browse files
authored
Merge pull request #4946 from PrimozGodec/fix-ProjectionWidgetTestMixin
[FIX] ProjectionWidgetMixinTests: set shape attribute only when discrete var available
2 parents 290c2a1 + ca9de36 commit 1895c41

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Orange/widgets/tests/base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,15 @@ def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):
825825
self.widget.set_visual_settings(key, value)
826826
simulate.combobox_activate_item(self.widget.controls.attr_color,
827827
self.data.domain[0].name)
828-
simulate.combobox_activate_item(self.widget.controls.attr_shape,
829-
self.data.domain[4].name)
828+
variables = self.data.domain.variables + self.data.domain.metas
829+
discrete_var = next(
830+
(x for x in variables if isinstance(x, DiscreteVariable)), None
831+
)
832+
if discrete_var:
833+
# activate item only when discrete variable available
834+
simulate.combobox_activate_item(
835+
self.widget.controls.attr_shape, discrete_var.name
836+
)
830837
font.setPointSize(12)
831838
self.assertFontEqual(graph.parameter_setter.num_legend.items[0][0].font, font)
832839

0 commit comments

Comments
 (0)