#NEWLINE# def test_proxy_no_proxy( self ) : #NEWLINE# #INDENT# os . environ [ 'no_proxy' ] = 'python.org' #NEWLINE# o = OpenerDirector ( ) #NEWLINE# ph = urllib2 . ProxyHandler ( dict ( http = 'proxy.example.com' ) ) #NEWLINE# o . add_handler ( ph ) #NEWLINE# req = Request ( 'http://www.perl.org/' ) #NEWLINE# self . assertEqual ( req . get_host ( ) , 'www.perl.org' ) #NEWLINE# r = o . open ( self ) #NEWLINE# self . assertEqual ( req . get_host ( ) , 'proxy.example.com' ) #NEWLINE# req = Request ( 'http://www.python.org' ) #NEWLINE# self . assertEqual ( req . get_host ( ) , 'www.python.org' ) #NEWLINE# r = o . open ( req ) #NEWLINE# self . assertEqual ( req . get_host ( ) , 'www.python.org' ) #NEWLINE# del os . environ [ 'no_proxy' ]