#NEWLINE# def test_find_widget( self ) : #NEWLINE# #INDENT# my_class = MyClass ( ) #NEWLINE# tester = ModalDialogTester ( my_class . run ) #NEWLINE# def check_and_close( tester ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with tester . capture_error ( ) : #NEWLINE# #INDENT# widget = tester . find_qt_widget ( type_ = QtGui . QPushButton , test = ( lambda x : ( x . text ( ) == 'OK' ) ) ) #NEWLINE# self . assertIsInstance ( widget , QtGui . QPushButton ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# tester . close ( ) #NEWLINE# #UNINDENT# #UNINDENT# tester . open_and_run ( when_opened = tester )