def test_check_datetime_disabled(self): """ Datetime option is disable if numerical is disabled as well. GH-2050 (code fixes) GH-2120 """ dat = """\ 01.08.16\t42.15\tneumann\t2017-02-20 03.08.16\t16.08\tneumann\t2017-02-21 04.08.16\t23.04\tneumann\t2017-02-22 03.09.16\t48.84\tturing\t2017-02-23 02.02.17\t23.16\tturing\t2017-02-24""" with named_file(dat, suffix=".tab") as filename: self.open_dataset(filename) domain_editor = self.widget.domain_editor idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1) qcombobox = QComboBox() combo = ComboDelegate(domain_editor, VarTableModel.typenames).createEditor(qcombobox, None, idx(2)) vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames) vartype_delegate.setEditorData(combo, idx(2)) counts = [4, 2, 4, 2] for i in range(4): vartype_delegate.setEditorData(combo, idx(i)) self.assertEqual(combo.count(), counts[i])
def test_check_datetime_disabled(self): """ Datetime option is disable if numerical is disabled as well. GH-2050 (code fixes) GH-2120 """ dat = """\ 01.08.16\t42.15\tneumann\t2017-02-20 03.08.16\t16.08\tneumann\t2017-02-21 04.08.16\t23.04\tneumann\t2017-02-22 03.09.16\t48.84\tturing\t2017-02-23 02.02.17\t23.16\tturing\t2017-02-24""" with named_file(dat, suffix=".tab") as filename: self.open_dataset(filename) domain_editor = self.widget.domain_editor idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1) qcombobox = QComboBox() combo = ComboDelegate(domain_editor, VarTableModel.typenames).createEditor( qcombobox, None, idx(2)) vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames) vartype_delegate.setEditorData(combo, idx(2)) counts = [4, 2, 4, 2] for i in range(4): vartype_delegate.setEditorData(combo, idx(i)) self.assertEqual(combo.count(), counts[i])