#NEWLINE# @ pytest . mark . parametrize ( 'widgetClass, model, exception, exceptionContains' , [ ( QtGui . QWidget , None , AttributeError , "has no attribute 'model'" ) , ( DemoTableView , None , ValueError , 'no model set for the current view' ) , ( DemoTableView , QtGui . QStandardItemModel ( ) , TypeError , 'model is not of type DataFrameModel' ) ] ) #NEWLINE# def test_tableViewMissing( self , widgetClass , qtbot , model , exception , exceptionContains ) : #NEWLINE# #INDENT# widget = widgetClass ( ) #NEWLINE# qtbot . addWidget ( widget ) #NEWLINE# with pytest . raises ( exception ) as excinfo : #NEWLINE# #INDENT# if model : #NEWLINE# #INDENT# widget . setModel ( QtGui . QStandardItemModel ( ) ) #NEWLINE# #UNINDENT# createDelegate ( 'foo' , 'bar' , widget ) #NEWLINE# #UNINDENT# assert ( exceptionContains in str ( excinfo . value ) )