#NEWLINE# def test_get_response_returns_none_when_queue_is_empty( self ) : #NEWLINE# #INDENT# 'Ensure that None is returned when the response Queue is empty.' #NEWLINE# queues = [ ] #NEWLINE# def _side_effect( ) : #NEWLINE# #INDENT# q = mock . MagicMock ( ) #NEWLINE# q . get_nowait . side_effect = queue . Empty ( ) #NEWLINE# queues . append ( q ) #NEWLINE# return q #NEWLINE# #UNINDENT# with mock . patch . object ( queue , 'Queue' , side_effect = _side_effect ) : #NEWLINE# #INDENT# with mock . patch . object ( thread , 'SessionThread' ) : #NEWLINE# #INDENT# p = pool . Pool ( None ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( len ( queues ) == 2 ) #NEWLINE# assert ( p . get_response ( ) is None ) #NEWLINE# assert ( len ( [ q for q in queues if q . get_nowait . called ] ) == 1 )