#NEWLINE# def test_pick_item( ) : #NEWLINE# #INDENT# items = [ 'a' , 'b' , 'c' ] #NEWLINE# labels = [ '1' , '2' , '3' ] #NEWLINE# with mock . patch ( 'glue.external.qt.QtGui.QInputDialog' ) as d : #NEWLINE# #INDENT# d . getItem . return_value = ( '1' , True ) #NEWLINE# assert ( pick_item ( d , labels ) == 'a' ) #NEWLINE# d . getItem . return_value = ( '2' , True ) #NEWLINE# assert ( pick_item ( items , labels ) == 'b' ) #NEWLINE# d . getItem . return_value = ( '3' , True ) #NEWLINE# assert ( pick_item ( items , labels ) == 'c' ) #NEWLINE# d . getItem . return_value = ( '3' , False ) #NEWLINE# assert ( pick_item ( items , labels ) is None )