#NEWLINE# def test_load_proxylist( self ) : #NEWLINE# #INDENT# with temp_file ( ) as tmp_file : #NEWLINE# #INDENT# content = ( '%s\n%s\n%s' % ( PROXY1 , PROXY2 , PROXY3 ) ) #NEWLINE# open ( tmp_file , 'w' ) . write ( content ) #NEWLINE# g = build_grab ( ) #NEWLINE# g . load_proxylist ( tmp_file , 'text_file' ) #NEWLINE# self . assertEqual ( tmp_file . config [ 'proxy_auto_change' ] , True ) #NEWLINE# servers = set ( ) #NEWLINE# for x in six . moves . range ( 10 ) : #NEWLINE# #INDENT# g . go ( 'http://yandex.ru' ) #NEWLINE# servers . add ( g . config [ 'proxy' ] ) #NEWLINE# #UNINDENT# self . assertTrue ( ( len ( servers ) > 1 ) ) #NEWLINE# g = build_grab ( ) #NEWLINE# g . load_proxylist ( tmp_file , 'text_file' , auto_change = False ) #NEWLINE# self . assertEqual ( g . config [ 'proxy_auto_change' ] , False ) #NEWLINE# servers = set ( ) #NEWLINE# for x in six . moves . range ( 10 ) : #NEWLINE# #INDENT# g . go ( 'http://yandex.ru' ) #NEWLINE# servers . add ( g . config [ 'proxy' ] ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( servers ) , 1 ) #NEWLINE# g = build_grab ( ) #NEWLINE# g . load_proxylist ( tmp_file , 'text_file' , auto_change = False , auto_init = False ) #NEWLINE# self . assertEqual ( g . config [ 'proxy_auto_change' ] , False ) #NEWLINE# g . go ( self . server . get_url ( ) ) #NEWLINE# self . assertEqual ( g . config [ 'proxy' ] , None )