;
"Ic               @   s  d  d l  Z  d  d l m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z m	 Z	 Gd   d e  j
  Z d   Z d   Z d   Z d	   Z Gd
   d  Z Gd   d  Z Gd   d e  Z Gd   d e j  Z Gd   d  Z Gd   d  Z Gd   d  Z d   Z d   Z Gd   d e j j  Z Gd   d  Z Gd   d e  j
  Z d    Z  Gd!   d" e  j
  Z! Gd#   d$ e  j
  Z" e# d%  Z$ e% d& k o e$ d' e&  n d S((   i    N(   u   support(   u   Requestu   OpenerDirectorc             B   s    |  Ee  Z d    Z d   Z d S(   c             C   s   |  j  t t j j d  t j j t j j  j	 d d  } | d d  d k o | d d   } n t j
 d k o d | j	 d d  } n d | } t j j |  } | j   } | j   d  S(	   Nu	   bogus urlu   \u   /i   i   u   :u   macu	   file://%s(   u   assertRaisesu
   ValueErroru   urllibu   requestu   urlopenu   osu   pathu   abspathu   __file__u   replaceu   nameu   readu   close(   u   selfu   fnameu   file_urlu   fu   buf(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_trivial   s    $
c          
   C   s   d d d d g f d d d g f d d d d	 d
 d d d g f d d d d g f g } x0 | D]( \ } } |  j  t j j |  |  q^ Wd  S(   Nu   a,b,cu   au   bu   cu   path"o,l"og"i"cal, exampleu   path"o,l"og"i"calu   exampleu   a, b, "c", "d", "e,f", g, hu   "c"u   "d"u   "e,f"u   gu   hu   a="b\"c", d="e\,f", g="h\\i"u   a="b"c"u   d="e,f"u   g="h\i"(   u   assertEqualsu   urllibu   requestu   parse_http_list(   u   selfu   testsu   stringu   list(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_parse_http_list%   s     N(   u   __name__u
   __module__u   test_trivialu   test_parse_http_list(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   TrivialTests   s   
	u   TrivialTestsc               C   s   d S(   u  
    The Request.headers dictionary is not a documented interface.  It should
    stay that way, because the complete set of headers are only accessible
    through the .get_header(), .has_header(), .header_items() interface.
    However, .headers pre-dates those methods, and so real code will be using
    the dictionary.

    The introduction in 2.4 of those methods was a mistake for the same reason:
    code that previously saw all (urllib2 user)-provided headers in .headers
    now sees only a subset (and the function interface is ugly and incomplete).
    A better change would have been to replace .headers dict with a dict
    subclass (or UserDict.DictMixin instance?)  that preserved the .headers
    interface and also provided access to the "unredirected" headers.  It's
    probably too late to fix that, though.


    Check .capitalize() case normalization:

    >>> url = "http://example.com"
    >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"]
    'blah'
    >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"]
    'blah'

    Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError,
    but that could be changed in future.

    N(    (    (    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_request_headers_dict1   s    c               C   s   d S(   u  
    Note the case normalization of header names here, to .capitalize()-case.
    This should be preserved for backwards-compatibility.  (In the HTTP case,
    normalization to .title()-case is done by urllib2 before sending headers to
    http.client).

    >>> url = "http://example.com"
    >>> r = Request(url, headers={"Spam-eggs": "blah"})
    >>> r.has_header("Spam-eggs")
    True
    >>> r.header_items()
    [('Spam-eggs', 'blah')]
    >>> r.add_header("Foo-Bar", "baz")
    >>> items = sorted(r.header_items())
    >>> items
    [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')]

    Note that e.g. r.has_header("spam-EggS") is currently False, and
    r.get_header("spam-EggS") returns None, but that could be changed in
    future.

    >>> r.has_header("Not-there")
    False
    >>> print(r.get_header("Not-there"))
    None
    >>> r.get_header("Not-there", "default")
    'default'

    N(    (    (    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_request_headers_methodsO   s    c             C   s   d S(   u  
    >>> mgr = urllib.request.HTTPPasswordMgr()
    >>> add = mgr.add_password
    >>> add("Some Realm", "http://example.com/", "joe", "password")
    >>> add("Some Realm", "http://example.com/ni", "ni", "ni")
    >>> add("c", "http://example.com/foo", "foo", "ni")
    >>> add("c", "http://example.com/bar", "bar", "nini")
    >>> add("b", "http://example.com/", "first", "blah")
    >>> add("b", "http://example.com/", "second", "spam")
    >>> add("a", "http://example.com", "1", "a")
    >>> add("Some Realm", "http://c.example.com:3128", "3", "c")
    >>> add("Some Realm", "d.example.com", "4", "d")
    >>> add("Some Realm", "e.example.com:3128", "5", "e")

    >>> mgr.find_user_password("Some Realm", "example.com")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com/")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com/spam")
    ('joe', 'password')
    >>> mgr.find_user_password("Some Realm", "http://example.com/spam/spam")
    ('joe', 'password')
    >>> mgr.find_user_password("c", "http://example.com/foo")
    ('foo', 'ni')
    >>> mgr.find_user_password("c", "http://example.com/bar")
    ('bar', 'nini')

    Actually, this is really undefined ATM
##     Currently, we use the highest-level path where more than one match:

##     >>> mgr.find_user_password("Some Realm", "http://example.com/ni")
##     ('joe', 'password')

    Use latest add_password() in case of conflict:

    >>> mgr.find_user_password("b", "http://example.com/")
    ('second', 'spam')

    No special relationship between a.example.com and example.com:

    >>> mgr.find_user_password("a", "http://example.com/")
    ('1', 'a')
    >>> mgr.find_user_password("a", "http://a.example.com/")
    (None, None)

    Ports:

    >>> mgr.find_user_password("Some Realm", "c.example.com")
    (None, None)
    >>> mgr.find_user_password("Some Realm", "c.example.com:3128")
    ('3', 'c')
    >>> mgr.find_user_password("Some Realm", "http://c.example.com:3128")
    ('3', 'c')
    >>> mgr.find_user_password("Some Realm", "d.example.com")
    ('4', 'd')
    >>> mgr.find_user_password("Some Realm", "e.example.com:3128")
    ('5', 'e')

    N(    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_password_managero   s    >c             C   s   d S(   u]  
    >>> mgr = urllib.request.HTTPPasswordMgr()
    >>> add = mgr.add_password

    The point to note here is that we can't guess the default port if there's
    no scheme.  This applies to both add_password and find_user_password.

    >>> add("f", "http://g.example.com:80", "10", "j")
    >>> add("g", "http://h.example.com", "11", "k")
    >>> add("h", "i.example.com:80", "12", "l")
    >>> add("i", "j.example.com", "13", "m")
    >>> mgr.find_user_password("f", "g.example.com:100")
    (None, None)
    >>> mgr.find_user_password("f", "g.example.com:80")
    ('10', 'j')
    >>> mgr.find_user_password("f", "g.example.com")
    (None, None)
    >>> mgr.find_user_password("f", "http://g.example.com:100")
    (None, None)
    >>> mgr.find_user_password("f", "http://g.example.com:80")
    ('10', 'j')
    >>> mgr.find_user_password("f", "http://g.example.com")
    ('10', 'j')
    >>> mgr.find_user_password("g", "h.example.com")
    ('11', 'k')
    >>> mgr.find_user_password("g", "h.example.com:80")
    ('11', 'k')
    >>> mgr.find_user_password("g", "http://h.example.com:80")
    ('11', 'k')
    >>> mgr.find_user_password("h", "i.example.com")
    (None, None)
    >>> mgr.find_user_password("h", "i.example.com:80")
    ('12', 'l')
    >>> mgr.find_user_password("h", "http://i.example.com:80")
    ('12', 'l')
    >>> mgr.find_user_password("i", "j.example.com")
    ('13', 'm')
    >>> mgr.find_user_password("i", "j.example.com:80")
    (None, None)
    >>> mgr.find_user_password("i", "http://j.example.com")
    ('13', 'm')
    >>> mgr.find_user_password("i", "http://j.example.com:80")
    (None, None)

    N(    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu"   test_password_manager_default_port   s    c             B   s)   |  Ee  Z g  Z d d   Z d   Z d S(   c             C   s   | | |  _  |  _ d  S(   N(   u   requ   data(   u   selfu   requ   data(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   open   s    c             G   s   | | |  _  |  _ d  S(   N(   u   protou   args(   u   selfu   protou   args(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   error   s    N(   u   __name__u
   __module__u
   addheadersu   Noneu   openu   error(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   MockOpener   s   
u
   MockOpenerc             B   s/   |  Ee  Z d d   Z d d  Z d   Z d S(   c             C   s   d  S(   N(    (   u   selfu   count(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   read   s    c             C   s   d  S(   N(    (   u   selfu   count(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   readline   s    c             C   s   d  S(   N(    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   close   s    N(   u   __name__u
   __module__u   Noneu   readu   readlineu   close(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockFile   s   
u   MockFilec             B   s   |  Ee  Z d    Z d S(   c             C   s   t  |  j    S(   N(   u   listu   values(   u   selfu   name(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   getheaders   s    N(   u   __name__u
   __module__u
   getheaders(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHeaders   s   
u   MockHeadersc             B   s,   |  Ee  Z d d   Z d   Z d   Z d S(   c             C   sA   t  j j |  |  | | | | f \ |  _ |  _ |  _ |  _ d  S(   N(   u   iou   StringIOu   __init__u   codeu   msgu   headersu   url(   u   selfu   codeu   msgu   headersu   datau   url(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__   s    c             C   s   |  j  S(   N(   u   headers(   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   info   s    c             C   s   |  j  S(   N(   u   url(   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   geturl   s    N(   u   __name__u
   __module__u   Noneu   __init__u   infou   geturl(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockResponse   s   
	u   MockResponsec             B   s    |  Ee  Z d    Z d   Z d S(   c             C   s   | |  _  d  S(   N(   u   ach_req(   u   selfu   request(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   add_cookie_header   s    c             C   s   | | |  _  |  _ d  S(   N(   u   ec_requ   ec_r(   u   selfu   responseu   request(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   extract_cookies   s    N(   u   __name__u
   __module__u   add_cookie_headeru   extract_cookies(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockCookieJar   s   
	u   MockCookieJarc             B   s    |  Ee  Z d    Z d   Z d S(   c             C   s   | |  _  | |  _ | |  _ d  S(   N(   u	   meth_nameu   handleu   action(   u   selfu	   meth_nameu   actionu   handle(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__   s    		c             G   s   |  j  |  j |  j |  S(   N(   u   handleu	   meth_nameu   action(   u   selfu   args(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __call__  s    N(   u   __name__u
   __module__u   __init__u   __call__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   FakeMethod   s   
	u
   FakeMethodc             B   sJ   |  Ee  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d S(   i  c             C   s   |  j  |  d  S(   N(   u   _define_methods(   u   selfu   methods(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__
  s    c             C   sm   xf | D]^ } t  |  d k o | \ } } n | d  } } t | | |  j  } t |  j | |  q Wd  S(   Ni   (   u   lenu   Noneu
   FakeMethodu   handleu   setattru	   __class__(   u   selfu   methodsu   specu   nameu   actionu   meth(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   _define_methods  s      c             O   s6  |  j  j j |  | | | f  | d  k o d  S| d k o |  S| d k o t d d i  d  } | S| d k o t d  S| j d  o} | | j d	  d
 d   } y t |  } Wn t	 k
 o Yn Xt d d i  d  } |  j  j
 d | d | | d i   S| d k o t j
 j d   n d  S(   Nu   return selfu   return responsei   u   OKu    u   return requestu   http://blah/u   erroru    i   u   httpi    u   raiseu   blah(   u   parentu   callsu   appendu   Noneu   MockResponseu   Requestu
   startswithu   rfindu   intu
   ValueErroru   erroru   urllibu   URLError(   u   selfu   fn_nameu   actionu   argsu   kwdsu   resu   code(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   handle  s*    $c             C   s   d  S(   N(    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   close(  s    c             C   s   | |  _  g  |  j  _ d  S(   N(   u   parentu   calls(   u   selfu   parent(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   add_parent)  s    	c             C   s%   t  | d  p d S|  j | j k  S(   Nu   handler_orderT(   u   hasattru   Trueu   handler_order(   u   selfu   other(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __lt__,  s    N(	   u   __name__u
   __module__u   handler_orderu   __init__u   _define_methodsu   handleu   closeu
   add_parentu   __lt__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHandler  s   
					u   MockHandlerc             C   s   g  } d } xm | D]e } Gd   d t   } | |  } | j | 7_ | j |   | d } | j |  |  j |  q W| S(   u  Create MockHandlers and add them to an OpenerDirector.

    meth_spec: list of lists of tuples and strings defining methods to define
    on handlers.  eg:

    [["http_error", "ftp_open"], ["http_open"]]

    defines methods .http_error() and .ftp_open() on one handler, and
    .http_open() on another.  These methods just record their arguments and
    return None.  Using a tuple instead of a string causes the method to
    perform some action (see MockHandler.handle()), eg:

    [["http_error"], [("http_open", "return request")]]

    defines .http_error() on one handler (which simply returns None), and
    .http_open() on another handler, which returns a Request object.

    i    c             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHandlerSubclassH  s   
 u   MockHandlerSubclassi   (   u   MockHandleru   handler_orderu
   add_parentu   appendu   add_handler(   u   openeru	   meth_specu   handlersu   countu   methsu   MockHandlerSubclassu   h(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   add_ordered_mock_handlers2  s     
c              G   s+   t    } x |  D] } | j |  q W| S(   N(   u   OpenerDirectoru   add_handler(   u   handler_instancesu   openeru   h(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   build_test_openerQ  s
    	 c             B   s)   |  Ee  Z d    Z d   Z d   Z d S(   c             C   s    | |  _  | |  _ |  j   d  S(   N(   u   codeu   headersu   reset(   u   selfu   codeu   headers(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__[  s    		c             C   s   d |  _  g  |  _ d  S(   Ni    (   u   _countu   requests(   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   reset_  s    	c             C   s   d d  l  } d d  l } d d  l } d d l m } |  j j | j |   |  j d k o[ |  j d |  _ | j	 j
 |  j } | j |  j  } |  j j d | t   |  j | |  S| |  _ | j d  } t d d | d | j    Sd  S(	   Ni    (   u   StringIOi   u   httpu   

i   u   OKu    (   u   emailu   http.clientu   copyu   iou   StringIOu   requestsu   appendu   deepcopyu   _countu   clientu	   responsesu   codeu   message_from_stringu   headersu   parentu   erroru   MockFileu   requ   MockResponseu   get_full_url(   u   selfu   requ   emailu   httpu   copyu   StringIOu   nameu   msg(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu	   http_openb  s    $		N(   u   __name__u
   __module__u   __init__u   resetu	   http_open(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHTTPHandlerW  s   
		u   MockHTTPHandlerc             B   s    |  Ee  Z d    Z d   Z d S(   c             C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   u   realmu   urlu   useru   password(   u   selfu   realmu   uriu   useru   password(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   add_passwordr  s    			c             C   s"   | |  _  | |  _ |  j |  j f S(   N(   u   target_realmu
   target_urlu   useru   password(   u   selfu   realmu   authuri(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   find_user_passwordw  s    		N(   u   __name__u
   __module__u   add_passwordu   find_user_password(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockPasswordManagerq  s   
	u   MockPasswordManagerc             B   sM   |  Ee  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d S(   c             C   s3   Gd   d t   } |  j t t   j |    d  S(   Nc             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   NonHandler  s   
u
   NonHandler(   u   objectu   assertRaisesu	   TypeErroru   OpenerDirectoru   add_handler(   u   selfu
   NonHandler(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_add_non_handler  s    	c             C   s   d d l  m } t   } d d g d g g } t | |  } | j t j j    x( d D]  } |  j | | j	 | d
  qZ Wd  S(   Ni    (   u   URLErroru   do_openu   return selfu
   proxy_openu   redirect_requestu   dou   proxyu   redirectu   ://example.com/(   u   do_openu   return self(   u
   proxy_openu   return self(   u   redirect_requestu   return self(   u   dou   proxyu   redirect(
   u   urllib.erroru   URLErroru   OpenerDirectoru   add_ordered_mock_handlersu   add_handleru   urllibu   requestu   UnknownHandleru   assertRaisesu   open(   u   selfu   URLErroru   ou	   meth_specu   handlersu   scheme(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_badly_named_methods  s    			 c             C   s   t    } d d d g d g d g d	 g g } t | |  } t d  } | j |  } |  j | | d  | d d f | d d f g } x[ t | | j  D]G \ } } | \ }	 }
 } } |  j |	 |
 f |  |  j | | f  q Wd  S(
   Nu	   http_openu   ftp_openu   http_error_302u   return selfu   http://example.com/i   i    (   u	   http_openu   return self(   u	   http_openu   return self(   u   OpenerDirectoru   add_ordered_mock_handlersu   Requestu   openu   assertEqualu   zipu   calls(   u   selfu   ou	   meth_specu   handlersu   requ   ru   callsu   expectedu   gotu   handleru   nameu   argsu   kwds(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_handled  s    	  c             C   s   t    } g  } xn d	 g d f d g d f g D]N \ } } Gd   d t  } | |  } | | _ | j |  | j |  q. W| j d  } |  j | j d d | d  |  j | j d d | d  d  S(
   Nu	   http_openu   return selfi  i    c             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHandlerSubclass  s   
 u   MockHandlerSubclassu   http://example.com/i   (   u	   http_openu   return self(   u   OpenerDirectoru   MockHandleru   handler_orderu   appendu   add_handleru   openu   assertEqualu   calls(   u   selfu   ou   handlersu   methsu   handler_orderu   MockHandlerSubclassu   hu   r(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_handler_order  s    	 	c             C   s   t    } d g d g g } t | |  } t d  } |  j t j j | j |  |  j | j	 | d d | f i  f g  d  S(   Nu	   http_openu   raiseu   return selfu   http://example.com/i    (   u	   http_openu   raise(   u	   http_openu   return self(
   u   OpenerDirectoru   add_ordered_mock_handlersu   Requestu   assertRaisesu   urllibu   erroru   URLErroru   openu   assertEqualu   calls(   u   selfu   ou	   meth_specu   handlersu   req(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   test_raise  s    	c             C   s  t    } d g d d g d d d g d g g } t | |  } Gd	   d
  } t d  } | j |  } | d d | f f | d d | |   d d i  f f g } xc t | | j  D]O \ } }	 | \ }
 } } |  j |
 | f |	 d  d   |  j | |	 d  q Wd  S(   Nu	   http_openu	   error 302u   http_error_400u   raiseu   http_error_302u   return responseu   http_error_303u
   http_errorc             B   s   |  Ee  Z d    Z d S(   c             S   s   d S(   NT(   u   True(   u   selfu   other(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __eq__  s    N(   u   __name__u
   __module__u   __eq__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   Unknown  s   
u   Unknownu   http://example.com/i    i   i.  u    (   u	   http_openu	   error 302(   u   http_error_400u   raise(   u   http_error_302u   return response(   u   OpenerDirectoru   add_ordered_mock_handlersu   Requestu   openu   zipu   callsu   assertEqual(   u   selfu   ou	   meth_specu   handlersu   Unknownu   requ   ru   callsu   expectedu   gotu   handleru   method_nameu   args(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_http_error  s$    		
  c             C   s  t    } d	 d
 g d d g g } t | |  } t d  } | j |  } | d d f | d d f | d d f | d d f g } x t | j  D] \ } \ } }	 }
 } | d k  oN |  j | |	 f | |  |  j t |
  d  |  j t	 |
 d t   q |  j | |	 f | |  |  j t |
  d  |  j t	 |
 d t   |  j |
 d d  k p t	 |
 d t   q Wd  S(   Nu   http_requestu   return requestu   http_responseu   return responseu   http://example.com/i    i   i   (   u   http_requestu   return request(   u   http_responseu   return response(   u   http_requestu   return request(   u   http_responseu   return response(   u   OpenerDirectoru   add_ordered_mock_handlersu   Requestu   openu	   enumerateu   callsu   assertEqualu   lenu   assert_u
   isinstanceu   Noneu   MockResponse(   u   selfu   ou	   meth_specu   handlersu   requ   ru   callsu   iu   handleru   nameu   argsu   kwds(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_processors  s*    	  N(	   u   __name__u
   __module__u   test_add_non_handleru   test_badly_named_methodsu   test_handledu   test_handler_orderu
   test_raiseu   test_http_erroru   test_processors(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   OpenerDirectorTests}  s   
						u   OpenerDirectorTestsc             C   sJ   t  j j |   } t j d k o$ | j d  o | d d   } n | S(   Nu   ntu   ///i   (   u   urllibu   requestu   pathname2urlu   osu   nameu
   startswith(   u   pathu   urlpath(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   sanepathname2url  s     c             B   s   |  Ee  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	 d
  Z d   Z d   Z d   Z d   Z d S(   c          
      s  Gd   d    G  f d   d t  j j  } d d  l } d } | |  } t   } | _ x~d d | j d	 d
 d g d d f d d d d d
 d g d d  f d d | j d g  d d  f g D]\ } } } }	 }
 } } t |  } d  | _	 | j
 |  } |  j | j | j k o
 d k n  |  j | j t j |   |  j | j |  |  j | j |
  |  j | j j |  |  j | j j |	  | j   } |  j | j d  |  |  j t | d  t |   q Wd  S(   Nc             B   s    |  Ee  Z d    Z d   Z d S(   c             S   s   | |  _  d  S(   N(   u   data(   u   selfu   data(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__!  s    c             S   s2   | | |  _  |  _ t j |  j  t |  j  f S(   N(   u   filenameu   filetypeu   iou   StringIOu   datau   len(   u   selfu   filenameu   filetype(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   retrfile"  s    N(   u   __name__u
   __module__u   __init__u   retrfile(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockFTPWrapper   s   
	u   MockFTPWrapperc                s,   |  Ee  Z d    Z e j   f d  Z d S(   c             S   s   | |  _  d  S(   N(   u   data(   u   selfu   data(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__'  s    c                sH   | | |  _  |  _ | | |  _ |  _ | |  _   |  j  |  _ |  j S(   N(   u   useru   passwdu   hostu   portu   dirsu   datau
   ftpwrapper(   u   selfu   useru   passwdu   hostu   portu   dirsu   timeout(   u   MockFTPWrapper(    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   connect_ftp(  s
    	N(   u   __name__u
   __module__u   __init__u   socketu   _GLOBAL_DEFAULT_TIMEOUTu   connect_ftp(   u
   __locals__(   u   MockFTPWrapper(    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   NullFTPHandler&  s   
	u   NullFTPHandleri    u   rheum rhaponicumu    ftp://localhost/foo/bar/baz.htmlu	   localhostu   Iu   foou   baru   baz.htmlu	   text/htmlu   ftp://localhost:80/foo/bar/iP   u   Du    u   ftp://localhost/baz.gif;type=au   Au   baz.gifu   Content-typeu   Content-length(   u   urllibu   requestu
   FTPHandleru   ftplibu
   MockOpeneru   parentu   FTP_PORTu   Noneu   Requestu   timeoutu   ftp_openu   assert_u   useru   passwdu   assertEqualu   hostu   socketu   gethostbynameu   portu   dirsu
   ftpwrapperu   filenameu   filetypeu   infou   getu   intu   len(   u   selfu   NullFTPHandleru   ftplibu   datau   hu   ou   urlu   hostu   portu   type_u   dirsu   filenameu   mimetypeu   requ   ru   headers(    (   u   MockFTPWrapperu.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_ftp  s:    
	 	*c             C   sd  d d  l  } d d  l } t j j   } t   } | _ t j } t	 t
 j j |   } d } d | d | d | j d  | f g } y | j | j    }	 Wn | j k
 o d }	 Yn X|	 o | j d |	 | f  n x| D]
}
 t | d  } z z | j |  Wd  | j   X| j t |
   } z( | j   } | j   } | j   } Wd  | j   Xt
 j |  } | j j | j d	 d } Wd  t
 j |  X|  j | |  |  j | d
 d  |  j | d d  |  j | d |  q Wx d | d d | j d  t
 j    | f d t
 j    | f g D]k }
 zT t | d  } z | j |  Wd  | j   X|  j! t j" j# | j t |
   Wd  t
 j |  Xq;Wt j j   } t   } | _ x d d d g D] \ }
 } t |
  } y | j |  Wn. t j" j# t% f k
 o |  j& |  YqX|  j& | j' | k  |  j | j( d  qWd  S(   Ni    s   hello, world
u   file://localhost%su	   file://%su   file://%s%su	   localhostu    u   wbu   usegmtu   Content-typeu
   text/plainu   Content-lengthu   13u   Last-modifiedu   file://localhost:80%su   file:///file_does_not_exist.txtu   file://%s:80%s/%su,   file://somerandomhost.ontheinternet.com%s/%su   file://ftp.example.com//foo.txtu    file://ftp.example.com///foo.txtu   file://ftp.example.com/foo.txtu   ftpT(   u   file://ftp.example.com//foo.txtTF(   u    file://ftp.example.com///foo.txtF(   u   file://ftp.example.com/foo.txtF()   u   email.utilsu   socketu   urllibu   requestu   FileHandleru
   MockOpeneru   parentu   supportu   TESTFNu   sanepathname2urlu   osu   pathu   abspathu   gethostbynameu   gethostnameu   gaierroru   appendu   openu   writeu   closeu	   file_openu   Requestu   readu   infou   geturlu   statu   utilsu
   formatdateu   st_mtimeu   Trueu   removeu   assertEqualu   getcwdu   assertRaisesu   erroru   URLErroru   Falseu   OSErroru   assert_u   requ   type(   u   selfu   emailu   socketu   hu   ou   TESTFNu   urlpathu   towriteu   urlsu	   localaddru   urlu   fu   ru   datau   headersu   newurlu   statsu   modifiedu   ftpu   req(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu	   test_fileN  s    	   c                s[  Gd   d t  j    G  f d   d  } t j j   } t   } | _ d } xGd d g D]9\ } } t | | i d	 d
 6 } d  | _	 | j
 d d  |   } | j | |  }	 |	 j |	 j |	 j |	 j |	 j |	 j d k d f |	 j   }
 |
 j |
 j |  j |	 j   |  |  j | j d  |  j | j d  |  j | j |  |  j | j d  |  j | j d d d  g  |  j | j |  q^ Wd! | _ |  j t j j | j | |  d" g | _  xd# D]}} t d |  } t! d d i  d  }	 | j" |  } | d  k o0 |  j# d | j$ k  |  j# d | j$ k  n/ |  j | j$ d d  |  j | j$ d d  |  j | j$ d d  |  j | j$ d d  | j
 d d  | j
 d d	  | j
 d d  | j
 d d  | j" |  } |  j | j$ d d  |  j | j$ d d	  |  j | j$ d d  |  j | j$ d d  qWd  S($   Nc             B   s    |  Ee  Z d    Z d   Z d S(   c             S   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   u   fpu   msgu   statusu   reason(   u   selfu   fpu   msgu   statusu   reason(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__  s    			c             S   s   d S(   Nu    (    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   read  s    N(   u   __name__u
   __module__u   __init__u   read(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHTTPResponse  s   
	u   MockHTTPResponsec                sM   |  Ee  Z d    Z e j d  Z d   Z d i  d  Z   f d   Z	 d S(   c             S   s(   d |  _  g  |  _ d  |  _ d |  _ d  S(   Ni    F(   u   levelu   req_headersu   Noneu   datau   Falseu   raise_on_endheaders(   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__  s    			c             S   s   | |  _  | |  _ |  S(   N(   u   hostu   timeout(   u   selfu   hostu   timeout(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __call__  s    		c             S   s   | |  _  d  S(   N(   u   level(   u   selfu   level(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   set_debuglevel  s    c             S   sr   | |  _  | |  _ |  j | j   7_ |  j j   | o | |  _ n |  j o d d  l } | j    n d  S(   Ni    (	   u   methodu   selectoru   req_headersu   itemsu   sortu   datau   raise_on_endheadersu   socketu   error(   u   selfu   methodu   urlu   bodyu   headersu   socket(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   request  s    		
c                s     t    i  d d  S(   Ni   u   OK(   u   MockFile(   u   self(   u   MockHTTPResponse(    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   getresponse  s    N(
   u   __name__u
   __module__u   __init__u   socketu   _GLOBAL_DEFAULT_TIMEOUTu   __call__u   set_debuglevelu   Noneu   requestu   getresponse(   u
   __locals__(   u   MockHTTPResponse(    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MockHTTPClass  s
   
		
u   MockHTTPClassu   http://example.com/u   GETu   POSTu   blahu   baru   Foou   Spamu   eggsi   u   OKu   example.comi    u   /u
   Connectionu   closeu    u   Content-lengthu   Content-typeu   0u!   application/x-www-form-urlencodedu   Hostu   foou   baz(   u   GETN(   u   POSTu   blah(   u
   Connectionu   close(   u   Foou   bar(   u   Spamu   eggsT(   u   Spamu   eggs(   u    N(%   u   iou   IOBaseu   urllibu   requestu   AbstractHTTPHandleru
   MockOpeneru   parentu   Noneu   Requestu   timeoutu   add_unredirected_headeru   do_openu   readu   readlineu   infou   geturlu   codeu   msgu   getu   __contains__u   assertEqualu   hostu   levelu   methodu   selectoru   req_headersu   datau   Trueu   raise_on_endheadersu   assertRaisesu   erroru   URLErroru
   addheadersu   MockResponseu   do_request_u   assert_u   unredirected_hdrs(   u   selfu   MockHTTPClassu   hu   ou   urlu   methodu   datau   requ   httpu   ru   hdrsu   newreq(    (   u   MockHTTPResponseu.   /mit/python/lib/python3.0/test/test_urllib2.pyu	   test_http  sl     		   	 c       	      C   s   t  j j   } t   } | _ d } d d d d g } xy | D]q } t | |  } | j |  } |  j | j d d  | j	 d d   | j |  } |  j | j d d  q> Wd  S(	   Nu    u#   http://example.com/foo/bar/baz.htmlu$   http://example.com//foo/bar/baz.htmlu$   http://example.com/foo//bar/baz.htmlu$   http://example.com/foo/bar//baz.htmlu   Hostu   example.comu   someproxy:3128(   u   urllibu   requestu   AbstractHTTPHandleru
   MockOpeneru   parentu   Requestu   do_request_u   assertEqualu   unredirected_hdrsu	   set_proxyu   None(	   u   selfu   hu   ou   datau   ds_urlsu   ds_urlu   ds_requ	   np_ds_requ   p_ds_req(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_http_doubleslash  s    	 c             C   s  t  j j   } t   } | _ d } t |  } t d d i  d |  } | j | |  } |  j | | k  |  j t	 | d   t d d i  d |  } | j | |  } |  j | | k  |  j t	 | d   t d d	 i  d |  } | j | |  } |  j | | k  |  j t	 | d   t d
 d i  d |  } |  j | j | |  d  k  |  j | j d  |  j | j | | d
 d i  f  d  S(   Nu   http://example.com/i   u   OKu    u   protoi   u   Acceptedi   u   Partial contenti  u   Bad gatewayu   http(   u   urllibu   requestu   HTTPErrorProcessoru
   MockOpeneru   parentu   Requestu   MockResponseu   http_responseu   assert_u   hasattru   Noneu   assertEqualu   protou   args(   u   selfu   hu   ou   urlu   requ   ru   newr(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_errors!  s(    c             C   s   t    } t j j |  } t   } | _ t d  } t d d i  d  } | j |  } |  j	 | j
 | k o
 | k n  |  j | j   d  |  j	 | j    | j | |  } |  j	 | j | k  |  j	 | j | k o
 | k n  d  S(   Nu   http://example.com/i   u   OKu    u   example.com(   u   MockCookieJaru   urllibu   requestu   HTTPCookieProcessoru
   MockOpeneru   parentu   Requestu   MockResponseu   http_requestu   assert_u   ach_requ   assertEqualsu   get_origin_req_hostu   is_unverifiableu   http_responseu   ec_requ   ec_r(   u   selfu   cju   hu   ou   requ   ru   newrequ   newr(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_cookies:  s    	'c             C   s  d } d } t  j j   } t   } | _ xd D]} xd D]} t | d |  } t | |  } | j d	 d
  | d  k	 o  | j d t	 t
 |    n | j d d  y* | | t   | d t i | d 6  Wn: t  j j k
 o( |  j | d k o
 | d  k	  Yn X|  j | j j   |  y |  j | j j   d  Wn+ t k
 o |  j | j j    Yn Xd   | j j D }	 |  j d |	 k  |  j d |	 k  |  j | j j d	 d
  |  j d | j j k  |  j d | j j k  q? Wq2 Wt |  } | d  }
 t | d d } d } y$ x |
 | | d  | d } qEWn3 t  j j k
 o! |  j | t  j j j  Yn Xt | d d } d } y( x! |
 | | d |  | d } qWn3 t  j j k
 o! |  j | t  j j j  Yn Xd  S(   Nu   http://example.com/a.htmlu   http://example.com/b.htmli-  i.  i/  i3  u
   blah
blah
u   http_error_%su   Nonsenseu   viking=withholdu   Content-Lengthu   Spamu   spamu   Blahu   locationu   GETc             S   s!   g  } |  ] } | | j    q
 S(    (   u   lower(   u   .0u   _[1]u   x(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   <listcomp>f  s    u   content-lengthu   content-typec          	   S   s-   |  j  | t   d d t i | d 6  d  S(   Ni.  u   Blahu   location(   u   http_error_302u   MockFileu   MockHeaders(   u   hu   requ   url(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   redirectq  s    u   origin_req_hostu   example.comi    u   http://example.com/i   u   http://example.com/%d(   i-  i.  i/  i3  (   Nu
   blah
blah
(   u   urllibu   requestu   HTTPRedirectHandleru
   MockOpeneru   parentu   Noneu   getattru   Requestu
   add_headeru   stru   lenu   add_unredirected_headeru   MockFileu   MockHeadersu   erroru	   HTTPErroru   assert_u   assertEqualu   requ   get_full_urlu
   get_methodu   AttributeErroru   has_datau   headersu
   assertTrueu   unredirected_hdrsu   max_repeatsu   max_redirections(   u   selfu   from_urlu   to_urlu   hu   ou   codeu   datau   methodu   requ   headersu   redirectu   count(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_redirectI  sd       &!	c       	      C   s   d d l  m } d d l m } |   } | | d d  t d d  } t j j   } t j j   } t j j	 |  } t
 | | | |  } | j d  |  j | j j d   d  S(	   Ni    (   u	   CookieJar(   u   interact_netscapeu   http://www.example.com/u	   spam=eggsi.  u%   Location: http://www.cracker.com/

u   Cookie(   u   http.cookiejaru	   CookieJaru   test.test_http_cookiejaru   interact_netscapeu   MockHTTPHandleru   urllibu   requestu   HTTPDefaultErrorHandleru   HTTPRedirectHandleru   HTTPCookieProcessoru   build_test_openeru   openu   assert_u   requ
   has_header(	   u   selfu	   CookieJaru   interact_netscapeu   cju   hhu   hdehu   hrhu   cpu   o(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_cookie_redirect  s    	c             C   s   t    } t j j t d d   } | j |  d	 g g } t | |  } t d  } |  j | j	   d  | j
 |  } |  j | j	   d  |  j | d d f g d   | j D  d  S(
   Nu   httpu   proxy.example.com:3128u	   http_openu   return responseu   http://acme.example.com/u   acme.example.comi    c             S   s%   g  } |  ] } | | d  d  q
 S(   i    i   (    (   u   .0u   _[1]u   tup(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   <listcomp>  s    (   u	   http_openu   return response(   u   OpenerDirectoru   urllibu   requestu   ProxyHandleru   dictu   add_handleru   add_ordered_mock_handlersu   Requestu   assertEqualu   get_hostu   openu   calls(   u   selfu   ou   phu	   meth_specu   handlersu   requ   r(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   test_proxy  s    	u   "c          	   C   s   t    } t   } t j j |  } d } t d d | | | f  } | j |  | j |  |  j | | d | | | d d  d  S(   Nu   ACME Widget Storei  u(   WWW-Authenticate: Basic realm=%s%s%s

u   Authorizationu!   http://acme.example.com/protected(   u   OpenerDirectoru   MockPasswordManageru   urllibu   requestu   HTTPBasicAuthHandleru   MockHTTPHandleru   add_handleru   _test_basic_auth(   u   selfu
   quote_charu   openeru   password_manageru   auth_handleru   realmu   http_handler(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_basic_auth  s    			c             C   s   |  j  d d  d  S(   Nu
   quote_charu   '(   u   test_basic_auth(   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu(   test_basic_auth_with_single_quoted_realm  s    c          	   C   s   t    } t j j t d d   } | j |  t   } t j j |  } d } t d d |  } | j |  | j |  |  j	 | | d | | | d d  d  S(   Nu   httpu   proxy.example.com:3128u   ACME Networksi  u(   Proxy-Authenticate: Basic realm="%s"

u   Proxy-authorizationu&   http://acme.example.com:3128/protected(
   u   OpenerDirectoru   urllibu   requestu   ProxyHandleru   dictu   add_handleru   MockPasswordManageru   ProxyBasicAuthHandleru   MockHTTPHandleru   _test_basic_auth(   u   selfu   openeru   phu   password_manageru   auth_handleru   realmu   http_handler(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_proxy_basic_auth  s    			c       
   	   C   s   Gd   d t   } Gd   d t j j  } Gd   d t j j  } |   } t   } | |  } | |  } d } t d d	 |  }	 | j |  | j |  | j |	  |  j | | d
 | |	 | d d  |  j	 | j
 d d g d  d  S(   Nc             B   s    |  Ee  Z d    Z d   Z d S(   c             S   s   t  j |   g  |  _ d  S(   N(   u   OpenerDirectoru   __init__u   recorded(   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   __init__  s    c             S   s   |  j  j |  d  S(   N(   u   recordedu   append(   u   selfu   info(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   record  s    N(   u   __name__u
   __module__u   __init__u   record(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   RecordingOpenerDirector  s   
	u   RecordingOpenerDirectorc             B   s   |  Ee  Z d    Z d S(   c             _   s-   |  j  j d  t j j j |  | |  d  S(   Nu   digest(   u   parentu   recordu   urllibu   requestu   HTTPDigestAuthHandleru   http_error_401(   u   selfu   argsu   kwds(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   http_error_401  s    N(   u   __name__u
   __module__u   http_error_401(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   TestDigestAuthHandler  s   
u   TestDigestAuthHandlerc             B   s   |  Ee  Z d    Z d S(   c             _   s-   |  j  j d  t j j j |  | |  d  S(   Nu   basic(   u   parentu   recordu   urllibu   requestu   HTTPBasicAuthHandleru   http_error_401(   u   selfu   argsu   kwds(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   http_error_401  s    N(   u   __name__u
   __module__u   http_error_401(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   TestBasicAuthHandler  s   
u   TestBasicAuthHandleru   ACME Networksi  u&   WWW-Authenticate: Basic realm="%s"

u   Authorizationu!   http://acme.example.com/protectedu   digestu   basici   (   u   OpenerDirectoru   urllibu   requestu   HTTPDigestAuthHandleru   HTTPBasicAuthHandleru   MockPasswordManageru   MockHTTPHandleru   add_handleru   _test_basic_authu   assertEqualu   recorded(
   u   selfu   RecordingOpenerDirectoru   TestDigestAuthHandleru   TestBasicAuthHandleru   openeru   password_manageru   digest_handleru   basic_handleru   realmu   http_handler(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu#   test_basic_and_digest_auth_handlers  s$    				c	             C   s  d d  l  }	 d	 \ }
 } | j | | |
 |  |  j | | j  |  j | | j  |  j |
 | j  |  j | | j  | j |  } |  j | j |  |  j | j	 |  |  j t
 | j  d  |  j | j d j |   t d |
 | f d  } d |	 j |  j   j   } |  j | j d j |  |  d  | _ | _ | j   | j |  } |  j t
 | j  d  |  j | j d j |   d  S(
   Ni    u   wileu   coyotei   u   %s:%su   asciiu   Basic i   (   u   wileu   coyote(   u   base64u   add_passwordu   assertEqualu   realmu   urlu   useru   passwordu   openu   target_realmu
   target_urlu   lenu   requestsu   assertFalseu
   has_headeru   bytesu   encodestringu   stripu   decodeu
   get_headeru   Noneu   reset(   u   selfu   openeru   auth_handleru   auth_headeru   realmu   http_handleru   password_manageru   request_urlu   protected_urlu   base64u   useru   passwordu   ru   userpassu   auth_hdr_value(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   _test_basic_auth   s,    
N(   u   __name__u
   __module__u   test_ftpu	   test_fileu	   test_httpu   test_http_doubleslashu   test_errorsu   test_cookiesu   test_redirectu   test_cookie_redirectu
   test_proxyu   test_basic_authu(   test_basic_auth_with_single_quoted_realmu   test_proxy_basic_authu#   test_basic_and_digest_auth_handlersu   _test_basic_auth(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   HandlerTests  s   
	/	Y	^				D					/u   HandlerTestsc             B   s    |  Ee  Z d    Z d   Z d S(   c             C   s  Gd   d t  j j  } Gd   d t  j j  } Gd   d t  j j  } t  j j } | | |  } |  j | |  |  j | |  | | |    } |  j | |  |  j | |  | |  } |  j | |  |   } |  j | t  j j  | t  j j  } |  j | t  j j  | t  j j    } |  j | t  j j  Gd   d t  j j  } | | |  } |  j | |  |  j | |  d  S(	   Nc             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MyHTTPHandler(  s   
 u   MyHTTPHandlerc             B   s   |  Ee  Z d    Z d S(   c             S   s   d  S(   N(    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   foo_open*  s    N(   u   __name__u
   __module__u   foo_open(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   FooHandler)  s   
u
   FooHandlerc             B   s   |  Ee  Z d    Z d S(   c             S   s   d  S(   N(    (   u   self(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   bar_open,  s    N(   u   __name__u
   __module__u   bar_open(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu
   BarHandler+  s   
u
   BarHandlerc             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   MyOtherHTTPHandlerG  s   
 u   MyOtherHTTPHandler(   u   urllibu   requestu   HTTPHandleru   BaseHandleru   build_openeru   opener_has_handler(   u   selfu   MyHTTPHandleru
   FooHandleru
   BarHandleru   build_openeru   ou   MyOtherHTTPHandler(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   test_build_opener'  s,    	c             C   s:   x3 | j  D] } | j | k o Pq
 q
 W|  j d  d  S(   NF(   u   handlersu	   __class__u   assert_u   False(   u   selfu   openeru   handler_classu   h(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   opener_has_handlerL  s
    
 	N(   u   __name__u
   __module__u   test_build_openeru   opener_has_handler(   u
   __locals__(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu	   MiscTests%  s   
	%u	   MiscTestsc             C   sV   d d l  m } t j | |   t j t j |   t t t t	 f } t j
 |   d  S(   Ni    (   u   test_urllib2(   u   testu   test_urllib2u   supportu   run_doctestu   urllibu   requestu   TrivialTestsu   OpenerDirectorTestsu   HandlerTestsu	   MiscTestsu   run_unittest(   u   verboseu   test_urllib2u   tests(    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu	   test_mainT  s    	u   __main__u   verbose('   u   unittestu   testu   supportu   osu   iou   socketu   urllib.requestu   urllibu   Requestu   OpenerDirectoru   TestCaseu   TrivialTestsu   test_request_headers_dictu   test_request_headers_methodsu   test_password_manageru"   test_password_manager_default_portu
   MockOpeneru   MockFileu   dictu   MockHeadersu   StringIOu   MockResponseu   MockCookieJaru
   FakeMethodu   MockHandleru   add_ordered_mock_handlersu   build_test_openeru   requestu   BaseHandleru   MockHTTPHandleru   MockPasswordManageru   OpenerDirectorTestsu   sanepathname2urlu   HandlerTestsu	   MiscTestsu   Noneu	   test_mainu   __name__u   True(    (    (    u.   /mit/python/lib/python3.0/test/test_urllib2.pyu   <module>   s>   !		 	A	/	,			  
/
