def testListModelDoesntKeepsReference(self): model = ListModelDoesntKeepsReference() view = TestView(model) obj = view.getData() self.assertEqual(type(obj), MyObject) self.assertEqual(obj.objectName(), object_name) obj.metaObject()
def testDelegateKeepsReferenceToEditor(self): view = TestView(None) delegate = DelegateKeepsReferenceToEditor() view.setItemDelegate(delegate) editor = view.getEditorWidgetFromItemDelegate() self.assertEqual(type(editor), QComboBox) self.assertEqual(editor.count(), 1) self.assertEqual(editor.itemData(0, Qt.DisplayRole), id_text) editor.metaObject()
def testListModelThatReturnsString(self): model = ListModelThatReturnsString() view = TestView(model) obj = view.getData() self.assertEqual(type(obj), py3k.unicode) self.assertEqual(obj, 'string')