Exemple #1
0
 def test_set_initial_value(self):
     widget = OWWidget()
     variables = [ContinuousVariable(x) for x in "abc"]
     model = VariableListModel(variables)
     widget.foo = variables[1]
     combo = gui.comboBox(widget.controlArea, widget, "foo", model=model)
     self.assertEqual(combo.currentIndex(), 1)
Exemple #2
0
 def setUp(self):
     self.widget = OWWidget()
     self.widget.foo = None
     self.attrs = VariableListModel()
     self.view = gui.listView(self.widget.controlArea,
                              self.widget,
                              "foo",
                              model=self.attrs)
Exemple #3
0
 def test_checked_extension(self):
     widget = OWWidget()
     gui.doubleSpin(widget=widget,
                    master=self,
                    value="some_param",
                    minv=1,
                    maxv=10,
                    checked="some_option")
Exemple #4
0
 def test_checked_extension(self):
     widget = OWWidget()
     widget.some_param = 0
     widget.some_option = False
     gui.doubleSpin(
         widget=widget,
         master=widget,
         value="some_param",
         minv=1,
         maxv=10,
         checked="some_option",
     )
Exemple #5
0
    def test_select(self):
        widget = OWWidget()
        widget.foo = None
        self.attrs = VariableListModel()
        view = gui.listView(widget.controlArea, widget, "foo", model=self.attrs)
        self.assertIsNone(widget.foo)
        a, b, c = (ContinuousVariable(x) for x in "abc")
        self.attrs[:] = [a, b, c]
        view.setCurrentIndex(self.attrs.index(0, 0))
        self.assertIs(widget.foo, a)
        view.setCurrentIndex(self.attrs.index(2, 0))
        self.assertIs(widget.foo, c)

        widget.foo = b
        selection = view.selectedIndexes()
        self.assertEqual(len(selection), 1)
        self.assertEqual(selection[0].row(), 1)
 def setUp(self):
     self.table = ContingencyTable(OWWidget())
     self.var1 = DiscreteVariable("char", ("a", "b"), ordered=True)
     self.var2 = DiscreteVariable("num", ("0", "1"), ordered=True)