ó
ŒwÛjc           @   s¢  d  d l  Z  d  d l m 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	 m
 Z
 d  d l Z y d  d l Z Wn e k
 r­ e Z n Xd  d l m Z d e  j f d „  ƒ  YZ d „  Z d	 „  Z d
 „  Z d „  Z d f  d „  ƒ  YZ d f  d „  ƒ  YZ d e f d „  ƒ  YZ d e j f d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ  d „  Z! d „  Z" d  e j# f d! „  ƒ  YZ$ d" e j% f d# „  ƒ  YZ& d$ f  d% „  ƒ  YZ' d& e  j f d' „  ƒ  YZ( d( „  Z) d) e  j f d* „  ƒ  YZ* d+ e  j e f d, „  ƒ  YZ+ d- e  j f d. „  ƒ  YZ, e d/ „ Z- e. d0 k rže- d1 e/ ƒ n  d S(2   iÿÿÿÿN(   t   test_support(   t   test_urllib(   t   Requestt   OpenerDirectort   AbstractDigestAuthHandler(   t   FakeHTTPMixint   TrivialTestsc           B   s5   e  Z d  „  Z d „  Z e j e d ƒ d „  ƒ Z RS(   c         C   sÑ   |  j  t t j d ƒ t j j t j ƒ j t j	 d ƒ } t j
 d k r‚ d d  l } t j | ƒ } | j | j d d ƒ ƒ } n  t j
 d k rž d | } n
 d	 | } t j | ƒ } | j ƒ  } | j ƒ  d  S(
   Ns	   bogus urlt   /t   riscosiÿÿÿÿs   /.s   ./t   nts
   file:///%ss	   file://%s(   t   assertRaisest
   ValueErrort   urllib2t   urlopent   ost   patht   abspatht   __file__t   replacet   sept   namet   stringt   expandt	   translatet	   maketranst   readt   close(   t   selft   fnameR   t   file_urlt   ft   buf(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   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 } x- | D]% \ } } |  j  t j | ƒ | ƒ q^ Wd  S(   Ns   a,b,ct   at   bt   cs   path"o,l"og"i"cal, examples   path"o,l"og"i"calt   examples   a, b, "c", "d", "e,f", g, hs   "c"s   "d"s   "e,f"t   gt   hs   a="b\"c", d="e\,f", g="h\\i"s   a="b"c"s   d="e,f"s   g="h\i"(   t   assertEqualR   t   parse_http_list(   R   t   testsR   t   list(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_parse_http_list4   s    s   ssl module requiredc      
   C   s?   t  j ƒ  } |  j t ƒ � t j d d d d | ƒWd  QXd  S(   Ns   https://localhostt   cafiles   /nonexistent/patht   context(   t   sslt   create_default_contextR
   R   R   R   (   R   R-   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_cafile_and_context<   s    (   t   __name__t
   __module__R    R+   t   unittestt
   skipUnlessR.   R0   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR      s   		c           C   s   d S(   s¶  
    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(    (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_request_headers_dictE   t    c           C   s   d S(   sŠ  
    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
    httplib).

    >>> 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 = r.header_items()
    >>> items.sort()
    >>> 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(    (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_request_headers_methodsc   R6   c         C   s   d S(   sï  
    >>> mgr = urllib2.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(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_password_manager„   s    >c         C   s   d S(   sV  
    >>> mgr = urllib2.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(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt"   test_password_manager_default_portÅ   R6   t
   MockOpenerc           B   s)   e  Z g  Z d e j d  „ Z d „  Z RS(   c         C   s!   | | | |  _  |  _ |  _ d  S(   N(   t   reqt   datat   timeout(   R   R;   R<   R=   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   openö   s    c         G   s   | | |  _  |  _ d  S(   N(   t   protot   args(   R   R?   R@   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   errorø   s    N(   R1   R2   t
   addheaderst   Nonet   sockett   _GLOBAL_DEFAULT_TIMEOUTR>   RA   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR:   ô   s   t   MockFilec           B   s)   e  Z d d  „ Z d d „ Z d „  Z RS(   c         C   s   d  S(   N(    (   R   t   count(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR   ü   R6   c         C   s   d  S(   N(    (   R   RG   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   readlineý   R6   c         C   s   d  S(   N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR   þ   R6   N(   R1   R2   RC   R   RH   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRF   û   s   t   MockHeadersc           B   s   e  Z d  „  Z RS(   c         C   s
   |  j  ƒ  S(   N(   t   values(   R   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt
   getheaders  s    (   R1   R2   RK   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRI      s   t   MockResponsec           B   s&   e  Z d d  „ Z d „  Z d „  Z RS(   c         C   sA   t  j  j |  | ƒ | | | | f \ |  _ |  _ |  _ |  _ d  S(   N(   t   StringIOt   __init__t   codet   msgt   headerst   url(   R   RO   RP   RQ   R<   RR   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN     s    c         C   s   |  j  S(   N(   RQ   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   info  s    c         C   s   |  j  S(   N(   RR   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   geturl
  s    N(   R1   R2   RC   RN   RS   RT   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRL     s   	t   MockCookieJarc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  d  S(   N(   t   ach_req(   R   t   request(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   add_cookie_header  s    c         C   s   | | |  _  |  _ d  S(   N(   t   ec_reqt   ec_r(   R   t   responseRW   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   extract_cookies  s    (   R1   R2   RX   R\   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRU     s   	t
   FakeMethodc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t	   meth_namet   handlet   action(   R   R^   R`   R_   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN     s    		c         G   s   |  j  |  j |  j | Œ S(   N(   R_   R^   R`   (   R   R@   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   __call__  s    (   R1   R2   RN   Ra   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR]     s   	t   MockHTTPResponsec           B   s   e  Z d  „  Z d „  Z RS(   c         C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   t   fpRP   t   statust   reason(   R   Rc   RP   Rd   Re   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN     s    			c         C   s   d S(   NR6   (    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR   !  s    (   R1   R2   RN   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRb     s   	t   MockHTTPClassc           B   sY   e  Z d  „  Z e j d „ Z d „  Z d d d „ Z d d d „ Z	 d „  Z
 d „  Z RS(   c         C   s(   g  |  _  d  |  _ t |  _ i  |  _ d  S(   N(   t   req_headersRC   R<   t   Falset   raise_on_endheaderst   _tunnel_headers(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   %  s    			c         C   s   | |  _  | |  _ |  S(   N(   t   hostR=   (   R   Rk   R=   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRa   +  s    		c         C   s   | |  _  d  S(   N(   t   level(   R   Rl   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   set_debuglevel0  s    c         C   s5   | |  _  | |  _ | r$ | |  _ n |  j j ƒ  d  S(   N(   t   _tunnel_hostt   _tunnel_portRj   t   clear(   R   Rk   t   portRQ   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt
   set_tunnel3  s
    		c         C   s}   | |  _  | |  _ | d  k	 r6 |  j | j ƒ  7_ n  |  j j ƒ  | rU | |  _ n  |  j ry d d  l } | j	 ƒ  ‚ n  d  S(   Niÿÿÿÿ(
   t   methodt   selectorRC   Rg   t   itemst   sortR<   Ri   RD   RA   (   R   Rs   RR   t   bodyRQ   RD   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRW   ;  s    			c         C   s   t  t ƒ  i  d d ƒ S(   NiÈ   t   OK(   Rb   RF   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   getresponseG  s    c         C   s   d  S(   N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR   J  s    N(   R1   R2   RN   RD   RE   Ra   Rm   RC   Rr   RW   Ry   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRf   $  s   			t   MockHandlerc           B   sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   iô  c         C   s   |  j  | ƒ d  S(   N(   t   _define_methods(   R   t   methods(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   Q  s    c         C   sk   xd | D]\ } t  | ƒ d k r. | \ } } n | d  } } t | | |  j ƒ } t |  j | | ƒ q Wd  S(   Ni   (   t   lenRC   R]   R_   t   setattrt	   __class__(   R   R|   t   specR   R`   t   meth(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR{   S  s     c         O   s*  |  j  j j |  | | | f ƒ | d  k r/ d  S| d k r? |  S| d k rd t d d i  d ƒ } | S| d k rz t d ƒ S| j d ƒ rü | | j d	 ƒ d
 } y t | ƒ } Wn t	 k
 rÃ n Xt d d i  d ƒ } |  j  j
 d | d | | d i  ƒ S| d k rt j d ƒ ‚ n  t s&t ‚ d  S(   Ns   return selfs   return responseiÈ   Rx   R6   s   return requests   http://blah/RA   t    i   t   httpi    t   raiset   blah(   t   parentt   callst   appendRC   RL   R   t
   startswitht   rfindt   intR   RA   R   t   URLErrorRh   t   AssertionError(   R   t   fn_nameR`   R@   t   kwdst   resRO   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR_   Y  s*    
#c         C   s   d  S(   N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR   o  R6   c         C   s   | |  _  g  |  j  _ d  S(   N(   R†   R‡   (   R   R†   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt
   add_parentp  s    	c         C   s#   t  | d ƒ s t S|  j | j k  S(   Nt   handler_order(   t   hasattrt   TrueR’   (   R   t   other(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   __lt__s  s    (	   R1   R2   R’   RN   R{   R_   R   R‘   R–   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRz   M  s   					c         C   sƒ   g  } d } xp | D]h } d t  f d „  ƒ  Y} | | ƒ } | j | 7_ | j |  ƒ | d } | j | ƒ |  j | ƒ q W| S(   s¯  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    t   MockHandlerSubclassc           B   s   e  Z RS(    (   R1   R2   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR—   �  s    i   (   Rz   R’   R‘   Rˆ   t   add_handler(   t   openert	   meth_spect   handlersRG   t   methsR—   R&   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   add_ordered_mock_handlersy  s    
c          G   s+   t  ƒ  } x |  D] } | j | ƒ q W| S(   N(   R   R˜   (   t   handler_instancesR™   R&   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   build_test_opener˜  s    	t   MockHTTPHandlerc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s    | |  _  | |  _ |  j ƒ  d  S(   N(   RO   RQ   t   reset(   R   RO   RQ   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   ¢  s    		c         C   s   d |  _  g  |  _ d  S(   Ni    (   t   _countt   requests(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR¡   ¦  s    	c         C   së   d d  l  } d d  l } d d l m } |  j j | j | ƒ ƒ |  j d k r­ |  j d |  _ t j |  j	 } | j
 | |  j ƒ ƒ } |  j j d | t ƒ  |  j	 | | ƒ S| |  _ | j
 | d ƒ ƒ } t d d | d	 | j ƒ  ƒ Sd  S(
   Niÿÿÿÿ(   RM   i    i   Rƒ   s   

iÈ   Rx   R6   (   t	   mimetoolst   copyRM   R£   Rˆ   t   deepcopyR¢   t   httplibt	   responsesRO   t   MessageRQ   R†   RA   RF   R;   RL   t   get_full_url(   R   R;   R¤   R¥   RM   R   RP   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt	   http_open©  s    		(   R1   R2   RN   R¡   R«   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR    ž  s   		t   MockHTTPSHandlerc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s    t  j j |  ƒ t ƒ  |  _ d  S(   N(   R   t   AbstractHTTPHandlerRN   Rf   t   httpconn(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   ¼  s    c         C   s   |  j  |  j | ƒ S(   N(   t   do_openR®   (   R   R;   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt
   https_openÀ  s    (   R1   R2   RN   R°   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR¬   ¸  s   	t   MockPasswordManagerc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   t   realmRR   t   usert   password(   R   R²   t   uriR³   R´   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   add_passwordÄ  s    			c         C   s"   | |  _  | |  _ |  j |  j f S(   N(   t   target_realmt
   target_urlR³   R´   (   R   R²   t   authuri(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   find_user_passwordÉ  s    		(   R1   R2   R¶   Rº   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR±   Ã  s   	t   OpenerDirectorTestsc           B   sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s6   d t  f d „  ƒ  Y} |  j t t ƒ  j | ƒ  ƒ d  S(   Nt
   NonHandlerc           B   s   e  Z RS(    (   R1   R2   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR¼   Ò  s   (   t   objectR
   t	   TypeErrorR   R˜   (   R   R¼   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_add_non_handlerÑ  s    	c         C   s   d d l  m } t ƒ  } d d g d g g } t | | ƒ } | j t  j ƒ  ƒ x( d D]  } |  j | | j | d
 ƒ qW Wd  S(   Niÿÿÿÿ(   RŒ   R¯   s   return selft
   proxy_opent   redirect_requestt   dot   proxyt   redirects   ://example.com/(   R¯   s   return self(   RÀ   s   return self(   RÁ   s   return self(   RÂ   RÃ   RÄ   (   R   RŒ   R   R�   R˜   t   UnknownHandlerR
   R>   (   R   RŒ   t   oRš   R›   t   scheme(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   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(
   NR«   t   ftp_opent   http_error_302s   return selfs   http://example.com/i   i    (   R«   s   return self(   R«   s   return self(   R   R�   R   R>   R'   t   zipR‡   (   R   RÆ   Rš   R›   R;   t   rR‡   t   expectedt   gott   handlerR   R@   R�   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_handledì  s    	 c         C   sÔ   t  ƒ  } g  } xq d	 g d f d g d f g D]Q \ } } d t f d „  ƒ  Y} | | ƒ } | | _ | j | ƒ | j | ƒ q. W| j d ƒ } |  j | j d d | d ƒ |  j | j d d | d ƒ d  S(
   NR«   s   return selfiô  i    R—   c           B   s   e  Z RS(    (   R1   R2   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR—     s    s   http://example.com/i   (   R«   s   return self(   R   Rz   R’   Rˆ   R˜   R>   R'   R‡   (   R   RÆ   R›   Rœ   R’   R—   R&   RÌ   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_handler_order  s    		c         C   s|   t  ƒ  } d g d g g } t | | ƒ } t d ƒ } |  j t j | j | ƒ |  j | j | d d | f i  f g ƒ d  S(   NR«   R„   s   return selfs   http://example.com/i    (   R«   R„   (   R«   s   return self(	   R   R�   R   R
   R   RŒ   R>   R'   R‡   (   R   RÆ   Rš   R›   R;   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt
   test_raise  s    	c         C   s'  t  ƒ  } d g d d g d d d g d g g } t | | ƒ } d	 d d
 „  ƒ  Y} t d ƒ } | j | ƒ } t | j ƒ d k sˆ t ‚ | d d | f f | d d | | ƒ  d d i  f f g } x] t | | j ƒ D]I \ } }	 | \ }
 } } |  j |
 | f |	 d  ƒ |  j | |	 d ƒ qÖ Wd  S(   NR«   s	   error 302t   http_error_400R„   RÊ   s   return responset   http_error_303t
   http_errort   Unknownc           B   s   e  Z d  „  Z RS(   c         S   s   t  S(   N(   R”   (   R   R•   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   __eq__7  R6   (   R1   R2   R×   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRÖ   6  s   s   http://example.com/i   i    i.  R6   (   R«   s	   error 302(   RÓ   R„   (   RÊ   s   return response(    (	   R   R�   R   R>   R}   R‡   R�   RË   R'   (   R   RÆ   Rš   R›   RÖ   R;   RÌ   R‡   RÍ   RÎ   RÏ   t   method_nameR@   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_http_error)  s$    		
c         C   ss  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  r |  j | |	 f | | ƒ |  j t |
 ƒ d ƒ |  j |
 d t ƒ q• |  j | |	 f | | ƒ |  j t |
 ƒ d ƒ |  j |
 d t ƒ |
 d d  k	 r• |  j |
 d t
 ƒ q• q• Wd  S(   Nt   http_requests   return requestt   http_responses   return responses   http://example.com/i    i   i   (   RÚ   s   return request(   RÛ   s   return response(   RÚ   s   return request(   RÛ   s   return response(   R   R�   R   R>   t	   enumerateR‡   R'   R}   t   assertIsInstanceRC   RL   (   R   RÆ   Rš   R›   R;   RÌ   R‡   t   iRÏ   R   R@   R�   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_processorsD  s(    	 ((	   R1   R2   R¿   RÈ   RÐ   RÑ   RÒ   RÙ   Rß   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR»   Ï  s   						c         C   sJ   d d  l  } | j |  ƒ } t j d k rF | j d ƒ rF | d } n  | S(   NiÿÿÿÿR	   s   ///i   (   t   urllibt   pathname2urlR   R   R‰   (   R   Rà   t   urlpath(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   sanepathname2urlh  s
    t   HandlerTestsc           B   sÑ   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  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 „  Z RS(   c            sn  d d d „  ƒ  Y‰  d t  j f ‡  f d †  ƒ  Y} d d  l } d } | | ƒ } t ƒ  } | _ xd d | j d	 d	 d
 d d g d d f	 d d | j d d	 d
 d d g d d f	 d d | j d d	 d
 d d g d d f	 d d | j d d	 d
 d d g d d f	 d d d d	 d	 d d d g d	 d  f	 d d | j d	 d	 d g  d d  f	 g D]\	 } } } }	 }
 } } } } t | ƒ } d  | _ | j	 | ƒ } |  j
 | j |	 ƒ |  j
 | j |
 ƒ |  j
 | j t j | ƒ ƒ |  j
 | j | ƒ |  j
 | j | ƒ |  j
 | j j | ƒ |  j
 | j j | ƒ | j ƒ  } |  j
 | j d ƒ | ƒ |  j
 t | d ƒ t | ƒ ƒ qHWd  S(   Nt   MockFTPWrapperc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         S   s   | |  _  d  S(   N(   R<   (   R   R<   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   t  R6   c         S   s2   | | |  _  |  _ t j |  j ƒ t |  j ƒ f S(   N(   t   filenamet   filetypeRM   R<   R}   (   R   Ræ   Rç   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   retrfileu  s    c         S   s   d  S(   N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR   x  R6   (   R1   R2   RN   Rè   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRå   s  s   		t   NullFTPHandlerc              s&   e  Z d  „  Z e j ‡  f d † Z RS(   c         S   s   | |  _  d  S(   N(   R<   (   R   R<   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   {  R6   c            sH   | | |  _  |  _ | | |  _ |  _ | |  _ ˆ  |  j ƒ |  _ |  j S(   N(   R³   t   passwdRk   Rq   t   dirsR<   t
   ftpwrapper(   R   R³   Rê   Rk   Rq   Rë   R=   (   Rå   (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   connect_ftp|  s
    	(   R1   R2   RN   RD   RE   Rí   (    (   Rå   (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRé   z  s   	iÿÿÿÿs   rheum rhaponicums    ftp://localhost/foo/bar/baz.htmlt	   localhostR6   t   It   foot   bars   baz.htmls	   text/htmls'   ftp://parrot@localhost/foo/bar/baz.htmlt   parrots*   ftp://%25parrot@localhost/foo/bar/baz.htmls   %parrots,   ftp://%2542parrot@localhost/foo/bar/baz.htmls	   %42parrots   ftp://localhost:80/foo/bar/iP   t   Ds   ftp://localhost/baz.gif;type=at   As   baz.gifs   Content-types   Content-length(    (   R   t
   FTPHandlert   ftplibR:   R†   t   FTP_PORTRC   R   R=   RÉ   R'   R³   Rê   Rk   RD   t   gethostbynameRq   Rë   Rì   Ræ   Rç   RS   t   getR‹   R}   (   R   Ré   Rö   R<   R&   RÆ   RR   Rk   Rq   R³   Rê   t   type_Rë   Ræ   t   mimetypeR;   RÌ   RQ   (    (   Rå   s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_ftpr  sL    
1	c         C   s”  d d  l  } d d  l } t j ƒ  } t ƒ  } | _ t j } t t	 j
 j | ƒ ƒ } d } d | d | d | j d ƒ | f g } y | j | j ƒ  ƒ }	 Wn | j k
 rº d }	 n X|	 rÛ | 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 ƒ } Wd  t	 j | ƒ X|  j | | ƒ |  j | d	 d
 ƒ |  j | d d ƒ |  j | d | ƒ |  j | |
 ƒ qâ Wx¬ d | d d | j d ƒ t	 j ƒ  | f d t	 j ƒ  | f g D]h }
 zQ t | d ƒ } z | j | ƒ Wd  | j ƒ  X|  j t j | j t |
 ƒ ƒ Wd  t	 j | ƒ Xq:Wt j ƒ  } t ƒ  } | _ xË d t  f d t! f d t! f d t  f d t! f g D]– \ }
 } t |
 ƒ } y | j | ƒ Wn( t j t" f k
 rI|  j# | ƒ n* X|  j# | j$ | k ƒ |  j | j% d ƒ |  j | j% d k | ƒ qöWd  S(   Niÿÿÿÿs   hello, world
s   file://localhost%ss	   file://%ss   file://%s%sRî   R6   t   wbs   Content-types
   text/plains   Content-lengtht   13s   Last-modifieds   file://localhost:80%ss   file:///file_does_not_exist.txts   file://%s:80%s/%ss,   file://somerandomhost.ontheinternet.com%s/%ss   file://ftp.example.com//foo.txts    file://ftp.example.com///foo.txts   file://ftp.example.com/foo.txts"   file://somehost//foo/something.txts#   file://localhost//foo/something.txtt   ftp(&   t   rfc822RD   R   t   FileHandlerR:   R†   R    t   TESTFNRã   R   R   R   Rø   t   gethostnamet   gaierrorRˆ   R>   t   writeR   t	   file_openR   R   RS   RT   t   statt
   formatdatet   st_mtimet   removeR'   t   getcwdR
   RŒ   R”   Rh   t   OSErrort
   assertTrueR;   t   type(   R   R   RD   R&   RÆ   R  Râ   t   towritet   urlst	   localaddrRR   R   RÌ   R<   RQ   t   respurlt   statst   modifiedRÿ   R;   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt	   test_file¬  s„    	
				c         C   s!  t  j ƒ  } t ƒ  } | _ d } xGd d g D]9\ } } t | | i d d 6ƒ } d  | _ | j d d ƒ t ƒ  } | 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/ Wt | _ |  j t  j | j	 | | ƒ d g | _ x}d D]u} t d | ƒ } t d	 d
 i  d ƒ } | j | ƒ }
 | d  k r|  j  d | j! ƒ |  j  d | j! ƒ 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(   Ns   http://example.com/t   GETt   POSTR…   Rñ   t   Foot   Spamt   eggsiÈ   Rx   s   example.comi    R   t
   ConnectionR   R6   s   Content-lengths   Content-typet   0s!   application/x-www-form-urlencodedt   HostRð   t   baz(   R  N(   R  R…   (   R  R   (   R  Rñ   (   R  R  (   R  R  (   R6   N("   R   R­   R:   R†   RC   R   R=   t   add_unredirected_headerRf   R¯   R   RH   RS   RT   RO   RP   Rù   t   has_keyR'   Rk   Rl   Rs   Rt   Rg   R<   R”   Ri   R
   RŒ   RB   RL   t   do_request_t   assertNotInt   unredirected_hdrs(   R   R&   RÆ   RR   Rs   R<   R;   Rƒ   RÌ   t   hdrst   newreq(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt	   test_http	  sd    		   	c   	      C   s´   t  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(	   NR6   s#   http://example.com/foo/bar/baz.htmls$   http://example.com//foo/bar/baz.htmls$   http://example.com/foo//bar/baz.htmls$   http://example.com/foo/bar//baz.htmlR  s   example.coms   someproxy:3128(
   R   R­   R:   R†   R   R!  R'   R#  t	   set_proxyRC   (	   R   R&   RÆ   R<   t   ds_urlst   ds_urlt   ds_reqt	   np_ds_reqt   p_ds_req(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_http_doubleslashG  s    	c         C   sº   t  j ƒ  } t ƒ  } | _ d } t | ƒ } | j | ƒ } |  j | j ƒ  d ƒ |  j | j ƒ  d ƒ d } t | ƒ } | j | ƒ } |  j | j ƒ  d ƒ |  j | j ƒ  d ƒ d  S(   Ns   http://www.python.org?getspams   www.python.orgs	   /?getspams   http://www.python.orgR6   (	   R   R­   R:   R†   R   R!  R'   t   get_hostt   get_selector(   R   R&   RÆ   t	   weird_urlR;   R%  t   url_without_path(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_fixpath_in_weirdurlsa  s    c         C   sš  t  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(   Ns   http://example.com/iÈ   Rx   R6   R?   iÊ   t   AcceptediÎ   s   Partial contentiö  s   Bad gatewayRƒ   (   R   t   HTTPErrorProcessorR:   R†   R   RL   RÛ   R  R“   RC   R'   R?   R@   (   R   R&   RÆ   RR   R;   RÌ   t   newr(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_errorst  s(    c         C   sú   t  ƒ  } t j | ƒ } t ƒ  } | _ t d ƒ } t d d i  d ƒ } | j | ƒ } |  j | j	 | k ox | k n ƒ |  j
 | j ƒ  d ƒ |  j | j ƒ  ƒ | j | | ƒ } |  j | j | k ƒ |  j | j | k oð | k n ƒ d  S(   Ns   http://example.com/iÈ   Rx   R6   s   example.com(   RU   R   t   HTTPCookieProcessorR:   R†   R   RL   RÚ   R  RV   R'   t   get_origin_req_hostt   is_unverifiableRÛ   RY   RZ   (   R   t   cjR&   RÆ   R;   RÌ   R%  R5  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_cookies�  s    	&c         C   s%  d } d } t  j ƒ  } t ƒ  } | _ xâd D]Ú} xÑd D]É} t | d | ƒ } t | | ƒ } | j d	 d
 ƒ t j	 | _
 | d  k	 r« | j d t t | ƒ ƒ ƒ n  | j d d ƒ y* | | t ƒ  | d t i | d 6ƒ ƒ Wn1 t  j k
 r|  j | d ƒ |  j | ƒ n X|  j | j j ƒ  | ƒ y |  j | j j ƒ  d ƒ Wn( t k
 ry|  j | j j ƒ  ƒ n Xg  | j j D] }	 |	 j ƒ  ^ q‡}
 |  j d |
 ƒ |  j d |
 ƒ |  j | j j d	 d
 ƒ |  j d | j j ƒ |  j d | j j ƒ q< Wq/ Wt | ƒ } t j	 | _
 | d „ } t | d d ƒ} d } t j	 | _
 y% x | | | d ƒ | d } q[WWn* t  j k
 r¦|  j | t  j j ƒ n Xt | d d ƒ} d } t j	 | _
 y) x" | | | d | ƒ | d } qÑWWn* t  j k
 r |  j | t  j j ƒ n Xd  S(   Ns   http://example.com/a.htmls   http://example.com/b.htmli-  i.  i/  i3  s
   blah
blah
s   http_error_%st   Nonsenses   viking=withholds   Content-LengthR  t   spamt   Blaht   locationR  s   content-lengths   content-typec      	   S   s-   |  j  | t ƒ  d d t i | d 6ƒ ƒ d  S(   Ni.  R>  R?  (   RÊ   RF   RI   (   R&   R;   RR   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRÄ   Ç  s    t   origin_req_hosts   example.comi    s   http://example.com/i   s   http://example.com/%d(   i-  i.  i/  i3  (   Ns
   blah
blah
(   R   t   HTTPRedirectHandlerR:   R†   RC   t   getattrR   t
   add_headerRD   RE   R=   t   strR}   R  RF   RI   t	   HTTPErrorR'   t   assertIsNotNoneR;   Rª   t
   get_methodt   AttributeErrorR  t   has_dataRQ   t   lowerR"  R#  t   max_repeatst   max_redirections(   R   t   from_urlt   to_urlR&   RÆ   RO   R<   Rs   R;   t   xRQ   RÄ   RG   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_redirectœ  sj    %	c         C   s  d } d d d g } d d d g } d } t  j ƒ  } t ƒ  } | _ t | ƒ } t j | _ xQ | D]I } | d	 | }	 |  j t  j	 | j
 | t ƒ  d
 d t i |	 d 6ƒ ƒ qe Wx^ | D]V } | d	 | }
 | j
 | t ƒ  d
 d t i |
 d 6ƒ ƒ |  j | j j ƒ  |
 ƒ q¹ Wd  S(   Ns   http://example.com/a.htmlRƒ   t   httpsRÿ   t   filet   imapt   ldaps   example.com/b.htmls   ://i.  s   Security LoopholeR?  s   That's fine(   R   RA  R:   R†   R   RD   RE   R=   R
   RE  RÊ   RF   RI   R'   R;   Rª   (   R   RM  t   valid_schemest   invalid_schemest   schemeless_urlR&   RÆ   R;   RÇ   t   invalid_urlt	   valid_url(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_invalid_redirectå  s$    c   	      C   s¯   d d l  m } d d l m } | ƒ  } | | d d ƒ t d d ƒ } t j ƒ  } t j ƒ  } t j | ƒ } t	 | | | | ƒ } | j
 d ƒ |  j | j j d ƒ ƒ d  S(	   Niÿÿÿÿ(   t	   CookieJar(   t   interact_netscapes   http://www.example.com/s	   spam=eggsi.  s%   Location: http://www.cracker.com/

t   Cookie(   t	   cookielibR[  t   test.test_cookielibR\  R    R   t   HTTPDefaultErrorHandlerRA  R7  RŸ   R>   R  R;   t
   has_header(	   R   R[  R\  R:  t   hht   hdeht   hrht   cpRÆ   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_cookie_redirectû  s    	c         C   sr   d } t  d d | ƒ } t j ƒ  } t j ƒ  } t | | | ƒ } | j d ƒ } |  j | j ƒ  | j ƒ  ƒ d  S(   Ns(   http://www.example.com/index.html#OK

i.  s
   Location: s   http://www.example.com(	   R    R   R`  RA  RŸ   R>   R'   RT   t   strip(   R   t   redirected_urlRb  Rc  Rd  RÆ   Rc   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_redirect_fragment  s    c            s�   t  j ‰  d } t j | ƒ t  _ ˆ j t t  d ˆ  ƒ t d ƒ ‰ ‡  ‡ ‡ f d †  } | t  j _ t j	 d ƒ } ˆ j
 | j ƒ  d ƒ d  S(	   Ns(   HTTP/1.1 302 Found
Location: ?query

t   HTTPConnections   /paths   /path?queryc            s?   ˆ j  | t ˆ ƒ ƒ ˆ  j |  | | | | Ž d |  j _ d  S(   Ns   HTTP/1.1 200 OK

Hello!(   R'   t   nextRW   R   t   fakedata(   t   connRs   RR   t   post   kw(   t
   real_classR   R  (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRW     s    s   http://python.org/paths   http://python.org/path?query(   s   /paths   /path?query(   R§   Rj  R   t   fakehttpt
   addCleanupR~   t   iterRW   R   R   R'   RT   (   R   t	   response1RW   Rc   (    (   Rp  R   R  s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_redirect_no_path  s    	c         C   sÎ   t  ƒ  } t j t d d ƒ ƒ } | j | ƒ d	 g g } t | | ƒ } t d ƒ } |  j | j ƒ  d ƒ | j	 | ƒ } |  j | j ƒ  d ƒ |  j | d d f g g  | j
 D] } | d d !^ q° ƒ d  S(
   NRƒ   s   proxy.example.com:3128R«   s   return responses   http://acme.example.com/s   acme.example.comi    i   (   R«   s   return response(   R   R   t   ProxyHandlert   dictR˜   R�   R   R'   R.  R>   R‡   (   R   RÆ   t   phRš   R›   R;   RÌ   t   tup(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt
   test_proxy$  s    	c         C   s×   d t  j d <t ƒ  } t j t d d ƒ ƒ } | j | ƒ t d ƒ } |  j | j	 ƒ  d ƒ | j
 | ƒ } |  j | j	 ƒ  d ƒ t d ƒ } |  j | j	 ƒ  d ƒ | j
 | ƒ } |  j | j	 ƒ  d ƒ t  j d =d  S(	   Ns
   python.orgt   no_proxyRƒ   s   proxy.example.coms   http://www.perl.org/s   www.perl.orgs   http://www.python.orgs   www.python.org(   R   t   environR   R   Rv  Rw  R˜   R   R'   R.  R>   (   R   RÆ   Rx  R;   RÌ   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_proxy_no_proxy5  s    	c         C   sÎ   t  ƒ  } t j t d d ƒ ƒ } | j | ƒ d	 g g } t | | ƒ } t d ƒ } |  j | j ƒ  d ƒ | j	 | ƒ } |  j | j ƒ  d ƒ |  j | d d f g g  | j
 D] } | d d !^ q° ƒ d  S(
   NRQ  s   proxy.example.com:3128R°   s   return responses   https://www.example.com/s   www.example.comi    i   (   R°   s   return response(   R   R   Rv  Rw  R˜   R�   R   R'   R.  R>   R‡   (   R   RÆ   Rx  Rš   R›   R;   RÌ   Ry  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_proxy_httpsE  s    	c         C   s  t  ƒ  } t j t d d ƒ ƒ } | j | ƒ t ƒ  } | j | ƒ t d ƒ } | j d d ƒ | j d d ƒ |  j | j	 ƒ  d ƒ |  j
 | j ƒ | j | ƒ } |  j d
 | j j ƒ |  j d | j j ƒ |  j | j ƒ |  j | j	 ƒ  d ƒ |  j | j d	 ƒ d ƒ d  S(   NRQ  s   proxy.example.com:3128s   https://www.example.com/s   Proxy-Authorizationt   FooBars
   User-Agentt   Grails   www.example.coms   Proxy-authorization(   s   Proxy-AuthorizationR  (   s
   User-AgentR€  (   R   R   Rv  Rw  R˜   R¬   R   RC  R'   R.  t   assertIsNoneRn   R>   R"  R®   Rg   t   assertInRF  t
   get_header(   R   RÆ   Rx  t   https_handlerR;   RÌ   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt$   test_proxy_https_proxy_authorizationT  s$    				t   "c      	   C   sƒ   t  ƒ  } t ƒ  } t j | ƒ } d } t d d | | | f ƒ } | j | ƒ | j | ƒ |  j | | d | | | d d ƒ d  S(   Ns   ACME Widget Storei‘  s(   WWW-Authenticate: Basic realm=%s%s%s

t   Authorizations!   http://acme.example.com/protected(   R   R±   R   t   HTTPBasicAuthHandlerR    R˜   t   _test_basic_auth(   R   t
   quote_charR™   t   password_managert   auth_handlerR²   t   http_handler(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_basic_authk  s    			c         C   s   |  j  d d ƒ d  S(   NRŠ  t   '(   RŽ  (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt(   test_basic_auth_with_single_quoted_realm{  s    c         C   sœ   t  ƒ  } t ƒ  } t j | ƒ } d } t d d | ƒ } | j | ƒ | j | ƒ d } t j | t f ƒ �' |  j	 | | d | | | d d ƒ Wd  QXd  S(   Ns   ACME Widget Storei‘  s$   WWW-Authenticate: Basic realm=%s

s   Basic Auth Realm was unquotedR‡  s!   http://acme.example.com/protected(
   R   R±   R   Rˆ  R    R˜   R    t   check_warningst   UserWarningR‰  (   R   R™   R‹  RŒ  R²   R�  RP   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt#   test_basic_auth_with_unquoted_realm~  s    			c      	   C   sŸ   t  ƒ  } t j t d d ƒ ƒ } | j | ƒ t ƒ  } t j | ƒ } d } t d d | ƒ } | j | ƒ | j | ƒ |  j | | d | | | d d ƒ d  S(   NRƒ   s   proxy.example.com:3128s   ACME Networksi—  s(   Proxy-Authenticate: Basic realm="%s"

s   Proxy-authorizations&   http://acme.example.com:3128/protected(	   R   R   Rv  Rw  R˜   R±   t   ProxyBasicAuthHandlerR    R‰  (   R   R™   Rx  R‹  RŒ  R²   R�  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_proxy_basic_auth�  s    			c   
   	   C   sõ   d t  f d „  ƒ  Y} d t j f d „  ƒ  Y} d t j f d „  ƒ  Y} | ƒ  } t ƒ  } | | ƒ } | | ƒ } d } t d d	 | ƒ }	 | j | ƒ | j | ƒ | j |	 ƒ |  j | | d
 | |	 | d d ƒ |  j | j	 d d g d ƒ d  S(   Nt   RecordingOpenerDirectorc           B   s   e  Z d  „  Z d „  Z RS(   c         S   s   t  j |  ƒ g  |  _ d  S(   N(   R   RN   t   recorded(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRN   «  s    c         S   s   |  j  j | ƒ d  S(   N(   R—  Rˆ   (   R   RS   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   record®  s    (   R1   R2   RN   R˜  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR–  ª  s   	t   TestDigestAuthHandlerc           B   s   e  Z d  „  Z RS(   c         _   s*   |  j  j d ƒ t j j |  | | Ž d  S(   Nt   digest(   R†   R˜  R   t   HTTPDigestAuthHandlert   http_error_401(   R   R@   R�   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRœ  ±  s    (   R1   R2   Rœ  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR™  °  s   t   TestBasicAuthHandlerc           B   s   e  Z d  „  Z RS(   c         _   s*   |  j  j d ƒ t j j |  | | Ž d  S(   Nt   basic(   R†   R˜  R   Rˆ  Rœ  (   R   R@   R�   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRœ  ¶  s    (   R1   R2   Rœ  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR�  µ  s   s   ACME Networksi‘  s&   WWW-Authenticate: Basic realm="%s"

R‡  s!   http://acme.example.com/protectedRš  Rž  i   (
   R   R   R›  Rˆ  R±   R    R˜   R‰  R'   R—  (
   R   R–  R™  R�  R™   R‹  t   digest_handlert   basic_handlerR²   R�  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt#   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 | ƒ ƒ d |
 | f } d |	 j | ƒ j ƒ  } |  j | j d j | ƒ | ƒ |  j | j d j | | ƒ d  | _ | _ | j ƒ  | j | ƒ } |  j t
 | j ƒ d ƒ |  j | j d j | ƒ ƒ d  S(
   Niÿÿÿÿt   wilet   coyotei   i    s   %s:%ss   Basic i   (   R¢  R£  (   t   base64R¶   R'   R²   RR   R³   R´   R>   R·   R¸   R}   R£   t   assertFalseRa  t   encodestringRg  Rƒ  R#  RC   R¡   (   R   R™   RŒ  t   auth_headerR²   R�  R‹  t   request_urlt   protected_urlR¤  R³   R´   RÌ   t   userpasst   auth_hdr_value(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR‰  Ð  s.    
(   R1   R2   Rü   R  R&  R-  R2  R6  R;  RP  RZ  Rf  Ri  Ru  Rz  R}  R~  R…  RŽ  R�  R“  R•  R¡  R‰  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRä   p  s,   	:	]	>					I													/t	   MiscTestsc           B   st   e  Z d  „  Z d „  Z d „  Z e j e d ƒ d „  ƒ Z e j e d ƒ d „  ƒ Z	 e j e d ƒ d „  ƒ Z
 RS(   c         C   s€  d t  j f d „  ƒ  Y} d t  j f d „  ƒ  Y} d t  j f d „  ƒ  Y} t  j } | | | ƒ } |  j | | ƒ |  j | | ƒ | | | ƒ  ƒ } |  j | | ƒ |  j | | ƒ | | ƒ } |  j | | ƒ | ƒ  } |  j | t  j ƒ | t  j ƒ } |  j | t  j ƒ | t  j ƒ  ƒ } |  j | t  j ƒ d t  j f d „  ƒ  Y} | | | ƒ } |  j | | ƒ |  j | | ƒ d  S(	   Nt   MyHTTPHandlerc           B   s   e  Z RS(    (   R1   R2   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR­  ÷  s    t
   FooHandlerc           B   s   e  Z d  „  Z RS(   c         S   s   d  S(   N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   foo_openù  R6   (   R1   R2   R¯  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR®  ø  s   t
   BarHandlerc           B   s   e  Z d  „  Z RS(   c         S   s   d  S(   N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   bar_openû  R6   (   R1   R2   R±  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR°  ú  s   t   MyOtherHTTPHandlerc           B   s   e  Z RS(    (   R1   R2   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR²    s    (   R   t   HTTPHandlert   BaseHandlert   build_openert   opener_has_handler(   R   R­  R®  R°  Rµ  RÆ   R²  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_build_openerö  s,    		c         C   s8   x1 | j  D] } | j | k r
 Pq
 q
 W|  j t ƒ d  S(   N(   R›   R   R  Rh   (   R   R™   t   handler_classR&   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR¶    s    c         C   sK   t  ƒ  } |  j t ƒ � } | j d ƒ Wd  QX|  j t | j ƒ d ƒ d  S(   Nt   invalids5   Unsupported digest authentication algorithm 'invalid'(   R   R
   R   t   get_algorithm_implsR'   RD  t	   exception(   R   RÏ   t   exc(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_unsupported_algorithm"  s    	s   ssl module requiredc      	   C   sÝ   xÖ t  d d ƒ t  d d ƒ D]¸ } t | ƒ } d | } |  j d ƒ z� t | ƒ j d d ƒ } t j } |  j | d	 | ƒ � t j	 d
 | ƒ Wd  QX|  j | d	 | ƒ � t j	 d | ƒ Wd  QXWd  |  j
 ƒ  Xq Wd  S(   Ni    i!   i   i   s   //localhost:7777/test%s/s   HTTP/1.1 200 OK

Hello.s   \s   \\s   contain control.*s   http:s   https:(   t   ranget   chrRq  t   reprR   R§   t
   InvalidURLt   assertRaisesRegexpR   R   t
   unfakehttp(   R   t   char_not   charRW  t   escaped_char_reprRÁ  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt(   test_url_path_with_control_char_rejected+  s    #
	c         C   sž   |  j  d ƒ d } d | d } zk t j } |  j | d ƒ � t j d j | ƒ ƒ Wd  QX|  j | d ƒ � t j d j | ƒ ƒ Wd  QXWd  |  j ƒ  Xd  S(	   Ns   HTTP/1.1 200 OK

Hello.s:   localhost:7777?a=1 HTTP/1.1
X-injected: header
TEST: 123s   //s   :8080/test/?test=as*   contain control.*\\r.*(found at least . .)s   http:{}s   contain control.*\\ns   https:{}(   Rq  R§   RÁ  RÂ  R   R   t   formatRÃ  (   R   Rk   RW  RÁ  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt4   test_url_path_with_newline_header_injection_rejectedC  s    		
	
 c      	   C   sö   xï t  t d d ƒ ƒ d g D]Ñ } t | ƒ } d j | ƒ } |  j d ƒ z• t | ƒ j d d ƒ } t j } |  j	 | d j | ƒ ƒ � t
 j d	 j | ƒ ƒ Wd  QX|  j	 | d j | ƒ ƒ � t
 j d
 j | ƒ ƒ Wd  QXWd  |  j ƒ  Xq Wd  S(   Ni    i!   i   s   //localhost{}/test/s   HTTP/1.1 200 OK

Hello.s   \s   \\s   contain control.*{}s   http:{}s   https:{}(   R*   R¾  R¿  RÈ  Rq  RÀ  R   R§   RÁ  RÂ  R   R   RÃ  (   R   RÄ  RÅ  RW  RÆ  RÁ  (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt(   test_url_host_with_control_char_rejectedY  s    #			 (   R1   R2   R·  R¶  R½  R3   R4   R.   RÇ  RÉ  RÊ  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyR¬  ô  s   	%			t   RequestTestsc           B   s†   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z RS(   c         C   s8   t  j d ƒ |  _ t  j d d d i d d 6ƒ|  _ d  S(   Ns   http://www.python.org/~jeremy/R<   RQ   t   tests   X-Test(   R   R   Rù   t   post(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   setUpn  s    	c         C   s6   |  j  d |  j j ƒ  ƒ |  j  d |  j j ƒ  ƒ d  S(   NR  R  (   R'   RÍ  RG  Rù   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_methodt  s    c         C   ss   |  j  |  j j ƒ  ƒ |  j d |  j j ƒ  ƒ |  j j d ƒ |  j  |  j j ƒ  ƒ |  j d |  j j ƒ  ƒ d  S(   NR  R=  R  (   R  Rù   RI  R'   RG  t   add_data(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_add_datax  s
    c         C   s   |  j  d |  j j ƒ  ƒ d  S(   Ns   http://www.python.org/~jeremy/(   R'   Rù   Rª   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_get_full_url  s    	c         C   sB   |  j  d |  j j ƒ  ƒ t j d ƒ } |  j  d | j ƒ  ƒ d  S(   Ns	   /~jeremy/s   http://www.python.org/R   (   R'   Rù   R/  R   R   (   R   R;   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_selectorƒ  s    c         C   s   |  j  d |  j j ƒ  ƒ d  S(   NRƒ   (   R'   Rù   t   get_type(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_get_typeˆ  s    c         C   s   |  j  d |  j j ƒ  ƒ d  S(   Ns   www.python.org(   R'   Rù   R.  (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_get_host‹  s    c         C   s)   t  j d ƒ } |  j d | j ƒ  ƒ d  S(   Ns   http://www.%70ython.org/s   www.python.org(   R   R   R'   R.  (   R   R;   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_get_host_unquoteŽ  s    c         C   sv   |  j  |  j j ƒ  ƒ |  j j d d ƒ |  j  |  j j ƒ  ƒ |  j d |  j j ƒ  ƒ |  j d |  j j ƒ  ƒ d  S(   Ns   www.perl.orgRƒ   s   www.python.org(   R  Rù   t	   has_proxyR'  R'   R8  R.  (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRz  ’  s
    c         C   s&   t  d ƒ } |  j d | j ƒ  ƒ d  S(   Ns   <URL:http://www.python.org>s   www.python.org(   R   R'   R.  (   R   R;   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_wrapped_url™  s    c         C   sp   t  d ƒ } |  j d | j ƒ  ƒ t  d ƒ } |  j d | j ƒ  ƒ d } t  | ƒ } |  j | j ƒ  | ƒ d  S(   Ns-   http://www.python.org/?qs=query#fragment=trues
   /?qs=querys   http://www.python.org/#fun=trueR   s.   http://docs.python.org/library/urllib2.html#OK(   R   R'   R/  Rª   (   R   R;   RR   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_url_fragment�  s    c         C   s6   |  j  t |  j d ƒ ƒ |  j  t |  j d ƒ ƒ d  S(   Nt   _Request__r_xxxt   _Request__r_method(   R¥  R“   Rù   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_private_attributes¨  s    c         C   s   d S(   sc  
        Issue 13211 reveals that HTTPError didn't implement the URLError
        interface even though HTTPError is a subclass of URLError.

        >>> err = urllib2.HTTPError(msg='something bad happened', url=None, code=None, hdrs=None, fp=None)
        >>> assert hasattr(err, 'reason')
        >>> err.reason
        'something bad happened'
        N(    (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_HTTPError_interface­  R6   c         C   sÈ   t  j d d d d d d d d d d ƒ } |  j t | d ƒ ƒ t | d ƒ sU t ‚ t | d	 ƒ sj t ‚ t | j ƒ s t ‚ y | j ƒ  Wn t k
 r­ |  j	 d
 ƒ n X|  j
 | j ƒ  d ƒ d S(   s]   
        Issue 15701= - HTTPError interface has info method available from URLError.
        RP   s   something bad happenedRR   RO   R$  s   Content-Length:42Rc   Re   RS   s   err.info() failedN(   R   RE  RC   R  R“   R�   t   callableRS   RH  t   failR'   (   R   t   err(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   test_HTTPError_interface_call¸  s    (   R1   R2   RÎ  RÏ  RÑ  RÒ  RÓ  RÕ  RÖ  R×  Rz  RÙ  RÚ  RÝ  RÞ  Râ  (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyRË  l  s   													c         C   sV   d d l  m } t j | |  ƒ t j t |  ƒ t t t t t	 f } t j
 | Œ  d  S(   Niÿÿÿÿ(   t   test_urllib2(   RÌ  Rã  R    t   run_doctestR   R   R»   Rä   R¬  RË  t   run_unittest(   t   verboseRã  R)   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt	   test_mainÈ  s    	t   __main__Ræ  (0   R3   RÌ  R    R   R   RD   RM   R   R   R   R   R§   R.   t   ImportErrorRC   t   test.test_urllibR   t   TestCaseR   R5   R7   R8   R9   R:   RF   Rw  RI   RL   RU   R]   Rb   Rf   Rz   R�   RŸ   R´  R    R­   R¬   R±   R»   Rã   Rä   R¬  RË  Rç  R1   R”   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_urllib2.pyt   <module>   sT   
+		!	A	/		),		™	ÿ ÿ †x\