ó
ŒwÛjc           @   sÔ  d  d l  m Z d  d l m Z d  d l m Z d  d l m Z m Z d  d l	 m
 Z
 d  d l m Z d  d l m Z m Z d  d l m 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 m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z e d d „ Z d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ  d e f d „  ƒ  YZ! d e! f d „  ƒ  YZ" d e f d  „  ƒ  YZ# d! „  Z$ e% d" k rÐe$ ƒ  n  d S(#   iÿÿÿÿ(   t   TestCase(   t   setup_testing_defaults(   t   Headers(   t   BaseHandlert   BaseCGIHandler(   t   util(   t	   validator(   t
   WSGIServert   WSGIRequestHandler(   t   make_server(   t   StringIO(   t
   BaseServerN(   t   supportt
   MockServerc           B   s    e  Z d  Z d „  Z d „  Z RS(   s   Non-socket HTTP serverc         C   s!   t  j |  | | ƒ |  j ƒ  d  S(   N(   R   t   __init__t   server_bind(   t   selft   server_addresst   RequestHandlerClass(    (    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_wsgiref.pyR      s    c         C   s/   |  j  \ } } | |  _ | |  _ |  j ƒ  d  S(   N(   R   t   server_namet   server_portt   setup_environ(   R   t   hostt   port(    (    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_wsgiref.pyR      s    		(   t   __name__t
   __module__t   __doc__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_wsgiref.pyR      s   	t   MockHandlerc           B   s    e  Z d  Z d „  Z d „  Z RS(   s   Non-socket HTTP handlerc         C   s%   |  j  |  _ |  j \ |  _ |  _ d  S(   N(   t   requestt
   connectiont   rfilet   wfile(   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_wsgiref.pyt   setup"   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_wsgiref.pyt   finish&   s    (   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_wsgiref.pyR       s   	c         C   s   | d d d g ƒ d g S(	   Ns   200 OKs   Content-Types
   text/plaint   Dates   Mon, 05 Jun 2006 18:49:54 GMTs   Hello, world!(   s   Content-Types
   text/plain(   R"   s   Mon, 05 Jun 2006 18:49:54 GMT(    (   t   environt   start_response(    (    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_wsgiref.pyt	   hello_app*   s    
s   GET / HTTP/1.0

c         C   s‹   t  d d |  t t ƒ } t | ƒ t ƒ  t ƒ  t j f \ } } } } | t _ z | j | | f d ƒ Wd  | t _ X| j ƒ  | j ƒ  f S(   Nt    iP   s	   127.0.0.1i¸"  (   s	   127.0.0.1i¸"  (   R	   R   R   R
   t   syst   stderrt   finish_requestt   getvalue(   t   appt   datat   servert   inpt   outt   errt   olderr(    (    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_wsgiref.pyt	   run_amock1   s    -	
c         C   s  |  ƒ  } d } x1 | D]) } | | | k s5 t  ‚ n  | d 7} q Wy | | Wn t k
 rb n Xt  d | ƒ ‚ y t t f Wn t k
 r“ n‚ X|  ƒ  } t | ƒ | k	 r¸ t  ‚ n  x) | D]! } | j ƒ  | k s¿ t  ‚ q¿ q¿ Wy | j ƒ  Wn t k
 rn Xt  d | ƒ ‚ d S(   s  Utility to compare a generic 2.1/2.2+ iterator with an iterable

    If running under Python 2.2+, this tests the iterator using iter()/next(),
    as well as __getitem__.  'make_it' must be a function returning a fresh
    iterator to be tested (since this may test the iterator twice).i    i   s   Too many items from __getitem__s   Too many items from .next()N(   t   AssertionErrort
   IndexErrort   itert   StopIterationt	   NameErrort   next(   t   make_itt   matcht   itt   nt   item(    (    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_wsgiref.pyt   compare_generic_iter>   s4    	 		 	 t   IntegrationTestsc           B   s8   e  Z e d  „ Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s=   |  j  | d t j j ƒ  d d | r- d p0 d d ƒ d  S(   Ns/   HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/i    sA   
Content-Type: text/plain
Date: Mon, 05 Jun 2006 18:49:54 GMT
s   Content-Length: 13
R&   s   
Hello, world!(   t   assertEqualR'   t   versiont   split(   R   R/   t
   has_length(    (    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_wsgiref.pyt   check_helloe   s    	(c         C   s    t  ƒ  \ } } |  j | ƒ d  S(   N(   R2   RD   (   R   R/   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_wsgiref.pyt   test_plain_hellop   s    c         C   s?   t  d d d d d ƒ \ } } |  j | j ƒ  d d ƒ d  S(   NR,   s   GET t   xi  s    HTTP/1.0

i    s!   HTTP/1.0 414 Request-URI Too Long(   R2   R@   t
   splitlines(   R   R/   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_wsgiref.pyt   test_request_lengtht   s    !c         C   s/   t  t t ƒ ƒ \ } } |  j | d t ƒd  S(   NRC   (   R2   R   R%   RD   t   False(   R   R/   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_wsgiref.pyt   test_validated_helloy   s    c         C   sU   d „  } t  t | ƒ ƒ \ } } |  j | j d ƒ ƒ |  j | j ƒ  d d ƒ d  S(   Nc         S   s   | d d ƒ d g S(   Ns   200 OKs   Content-Types
   text/plains   Hello, world!(   s   Content-Types
   text/plain(    (   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_wsgiref.pyt   bad_app   s    s;   A server error occurred.  Please contact the administrator.iþÿÿÿs]   AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: <type 'tuple'>(   R2   R   t
   assertTruet   endswithR@   RG   (   R   RK   R/   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_wsgiref.pyt   test_simple_validation_error~   s    	
(   R   R   t   TrueRD   RE   RH   RJ   RN   (    (    (    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_wsgiref.pyR?   c   s
   			t   UtilityTestsc           B   s•   e  Z d  „  Z d d „ Z d „  Z d „  Z d 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   sf   i | d 6| d 6} t  j | ƒ |  j t  j | ƒ | ƒ |  j | d | ƒ |  j | d | ƒ | S(   Nt   SCRIPT_NAMEt	   PATH_INFO(   R   R   R@   t   shift_path_info(   R   t   sn_int   pi_int   partt   sn_outt   pi_outt   env(    (    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_wsgiref.pyt
   checkShift�   s    c         C   s   i  } t  j | ƒ t | t ƒ r9 |  j | | t ƒ n |  j | | | ƒ i | | 6} t  j | ƒ |  j | | | ƒ d  S(   N(   R   R   t
   isinstanceR
   t   assertIsInstanceR@   t   assertIs(   R   t   keyt   valuet   altRY   (    (    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_wsgiref.pyt   checkDefault—   s    c         K   s%   t  j | ƒ |  j | | | ƒ d  S(   N(   R   R   R@   (   R   R^   R_   t   kw(    (    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_wsgiref.pyt   checkCrossDefault¥   s    c         K   s*   t  j | ƒ |  j t  j | ƒ | ƒ d  S(   N(   R   R   R@   t   application_uri(   R   t   uriRb   (    (    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_wsgiref.pyt   checkAppURI©   s    i   c         K   s-   t  j | ƒ |  j t  j | | ƒ | ƒ d  S(   N(   R   R   R@   t   request_uri(   R   Re   t   queryRb   (    (    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_wsgiref.pyt   checkReqURI­   s    c         C   s}   | | d „ } t  | | ƒ | ƒ  } |  j | j j ƒ x | D] } q? W|  j | j j ƒ | j ƒ  |  j | j j ƒ d  S(   Nc         S   s   t  j t |  ƒ | ƒ S(   N(   R   t   FileWrapperR
   (   t   textt   size(    (    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_wsgiref.pyR9   ³   s    (   R>   t   assertFalset   fileliket   closedt   closeRL   (   R   Rk   Rl   R:   R9   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_wsgiref.pyt   checkFW±   s    	
c         C   s�   |  j  d d d d d ƒ |  j  d d d d d ƒ |  j  d d d  d d ƒ |  j  d d d d d ƒ |  j  d d	 d d d ƒ d  S(
   NR&   t   /s   /xRF   s   /as   /x/ys   /a/xs   /ys   /x/(   RZ   t   None(   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_wsgiref.pyt   testSimpleShiftsÃ   s
    c         C   s  |  j  d d d d d ƒ |  j  d d d d d ƒ |  j  d d d d	 d ƒ |  j  d d
 d d	 d ƒ |  j  d d d d	 d ƒ |  j  d d d d	 d ƒ |  j  d d d d d ƒ |  j  d d d d d ƒ |  j  d d d d d ƒ |  j  d d d d d ƒ |  j  d d d  d d ƒ d  S(   Ns   /a/bs   /../ys   ..s   /as   /yR&   s   //yt   ys   /a/b/ys   //y/Rr   s   /./ys   /./y/s   ///./..//y/.//s   /y/s   ///s   /a/b/s   /.//s   /x//RF   s   /a/b/xs   /.(   RZ   Rs   (   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_wsgiref.pyt   testNormalizedShiftsÊ   s    c         C   sp   xi d d d d d d d d d f d  d! d" d t  d ƒ f d t  ƒ  f d# g D] \ } } |  j | | ƒ qL Wd  S($   Nt   SERVER_NAMEs	   127.0.0.1t   SERVER_PORTt   80t   SERVER_PROTOCOLs   HTTP/1.0t	   HTTP_HOSTt   REQUEST_METHODt   GETRQ   R&   RR   Rr   s   wsgi.versioni   i    s   wsgi.run_onces   wsgi.multithreads   wsgi.multiprocesss
   wsgi.inputs   wsgi.errorss   wsgi.url_schemet   http(   Rw   s	   127.0.0.1(   Rx   Ry   (   Rz   s   HTTP/1.0(   R{   s	   127.0.0.1(   R|   R}   (   RQ   R&   (   RR   Rr   (   i   i    (   s   wsgi.run_oncei    (   s   wsgi.multithreadi    (   s   wsgi.multiprocessi    (   s   wsgi.url_schemeR~   (   R
   Ra   (   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_wsgiref.pyt   testDefaults×   s     	c         C   sž   |  j  d d d d ƒ|  j  d d d d ƒ|  j  d d d d ƒ|  j  d d d d	 ƒ|  j  d d
 d d ƒ|  j  d d d d ƒ|  j  d d d d ƒd  S(   NR{   s   foo.barRw   s   wsgi.url_schemet   httpst   HTTPSt   ont   1t   yesR~   t   fooRx   Ry   t   443(   Rc   (   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_wsgiref.pyt   testCrossDefaultsê   s    c         C   s�   |  j  t j i  ƒ d ƒ |  j  t j i d d 6ƒ d ƒ |  j  t j i d d 6ƒ d ƒ |  j  t j i d d 6ƒ d ƒ |  j  t j i d d 6ƒ d ƒ d  S(   NR~   R…   R�   R‚   R€   R„   Rƒ   (   R@   R   t   guess_scheme(   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_wsgiref.pyt   testGuessSchemeó   s
       c         C   s¨   |  j  d ƒ |  j  d d d ƒ|  j  d d d ƒ|  j  d d d	 d
 d ƒ|  j  d d d ƒ|  j  d d d d d ƒ|  j  d d d ƒ|  j  d d
 d d d  ƒd  S(   Ns   http://127.0.0.1/s   http://127.0.0.1/spamRQ   s   /spams   http://127.0.0.1/sp%E4ms   /späms   http://spam.example.com:2071/R{   s   spam.example.com:2071Rx   t   2071s   http://spam.example.com/Rw   s   spam.example.coms	   127.0.0.1s   https://127.0.0.1/R�   R‚   s   http://127.0.0.1:8000/t   8000(   Rf   Rs   (   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_wsgiref.pyt   testAppURIsú   s    c      	   C   sû   |  j  d ƒ |  j  d d d ƒ|  j  d d d ƒ|  j  d d d d	 d ƒ|  j  d
 d d d	 d ƒ|  j  d d d d	 d ƒ|  j  d d d d	 d ƒ|  j  d d d d	 d d d ƒ|  j  d d d d	 d d d ƒ|  j  d d d d d	 d d d ƒd  S(   Ns   http://127.0.0.1/s   http://127.0.0.1/spamRQ   s   /spams   http://127.0.0.1/sp%E4ms   /späms   http://127.0.0.1/spammity/spams	   /spammityRR   s    http://127.0.0.1/spammity/sp%E4ms"   http://127.0.0.1/spammity/spam;hams	   /spam;hams/   http://127.0.0.1/spammity/spam;cookie=1234,5678s   /spam;cookie=1234,5678s%   http://127.0.0.1/spammity/spam?say=nit   QUERY_STRINGs   say=nis'   http://127.0.0.1/spammity/spam?s%E4y=nis   s%E4y=nii    (   Ri   (   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_wsgiref.pyt   testReqURIs  s"    c         C   s)   |  j  d d d d d d d g ƒ d  S(   Nt   xyzi2   ix   i(   i
   (   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_wsgiref.pyt   testFileWrapper  s    c         C   s¼   xY d j  ƒ  D]K } xB | | j ƒ  | j ƒ  | j ƒ  f D] } |  j t j | ƒ ƒ q8 Wq WxY d j  ƒ  D]K } xB | | j ƒ  | j ƒ  | j ƒ  f D] } |  j t j | ƒ ƒ q” Wqi Wd  S(   Nsb   Connection Keep-Alive Proxy-Authenticate Proxy-Authorization TE Trailers Transfer-Encoding Upgrades4   Accept Cache-Control Date Pragma Trailer Via Warning(   RB   t   titlet   uppert   lowerRL   R   t   is_hop_by_hopRm   (   R   t   hopR`   (    (    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_wsgiref.pyt   testHopByHop  s    ++N(   R   R   RZ   Rs   Ra   Rc   Rf   Ri   Rq   Rt   Rv   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_wsgiref.pyRP   �   s   													t   HeaderTestsc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s=  d g } |  j  t t g  ƒ ƒ d ƒ |  j  t t | ƒ ƒ d ƒ |  j  t | ƒ j ƒ  d g ƒ |  j  t | ƒ j ƒ  d g ƒ |  j  t | ƒ j ƒ  | ƒ |  j t | ƒ j ƒ  | ƒ t g  ƒ } | d =d | d <xx | j | j | j	 | j
 | j f D]R } |  j | d ƒ ƒ |  j | d ƒ ƒ |  j | d ƒ ƒ |  j | d ƒ ƒ qý W|  j  | d d ƒ d	 | d <|  j  | d d	 ƒ |  j  | j
 d ƒ d	 g ƒ |  j  | j	 d d
 ƒ d	 ƒ |  j  | j	 d d
 ƒ d
 ƒ |  j  | j d d
 ƒ d	 ƒ |  j  | j d d
 ƒ d
 ƒ |  j  | d d	 ƒ |  j  | d d
 ƒ d  S(   NRF   Ru   i    i   R…   t   bart   Foot   FOOt   bazt   wheet   zoo(   RF   Ru   (   R@   t   lenR   t   keyst   valuest   itemst   assertIsNott   has_keyt   __contains__t   gett   get_allt   __getitem__RL   Rm   t
   setdefault(   R   t   testt   ht   m(    (    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_wsgiref.pyt   testMappingInterface/  s2    	  
+
c         C   s   |  j  t t d ƒ d  S(   NR…   (   t   assertRaisest	   TypeErrorR   (   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_wsgiref.pyt   testRequireListN  s    c         C   s±   t  g  ƒ } |  j t | ƒ d ƒ | j d d d d ƒ|  j | d d ƒ |  j t | ƒ d ƒ | j d d d	 d  ƒ|  j | j d ƒ d d
 g ƒ |  j t | ƒ d ƒ d  S(   Ns   
R…   R˜   R›   t   spams   bar; baz="spam"s   foo: bar; baz="spam"

R™   t   cheeses   bar; cheeses*   foo: bar; baz="spam"
Foo: bar; cheese

(   R   R@   t   strt
   add_headerRs   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_wsgiref.pyt
   testExtrasR  s    (   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_wsgiref.pyR—   -  s   		t   ErrorHandlerc           B   s,   e  Z d  Z e e j j ƒ  ƒ Z d „  Z RS(   s/   Simple handler subclass for testing BaseHandlerc      
   K   s?   t  | ƒ t j |  t d ƒ t ƒ  t ƒ  | d t d t ƒd  S(   NR&   t   multithreadt   multiprocess(   R   R   R   R
   RO   (   R   Rb   (    (    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_wsgiref.pyR   m  s    
(	   R   R   R   t   dictt   osR#   R¡   t
   os_environR   (    (    (    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_wsgiref.pyRµ   e  s   t   TestHandlerc           B   s   e  Z d  Z d „  Z RS(   sA   Simple handler subclass for testing BaseHandler, w/error passthruc         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_wsgiref.pyt   handle_errorw  s    (   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_wsgiref.pyR»   t  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 RS(   iP   i2   c      	   C   sj  i d d 6d d 6d d 6d d 6d	 d
 6} t  j t d | ƒ �$ t d d d d ƒ } | j ƒ  Wd  QXx6 d# D]. } |  j t | d | ƒ | j d | ƒ qk Wi  } t | ƒ x3 | j ƒ  D]% \ } } | | k rº | | | <qº qº W| j	 i d d 6d d 6d d 6d d
 6| j
 ƒ  d 6| j ƒ  d 6d$ d 6t d 6d d 6t d  6t d! 6t j d" 6ƒ |  j | j | ƒ d  S(%   Ns   /my/homet   HOMEs   /my/patht   PATHs   fr_FR.UTF-8t   LANGt   test_script_nameRQ   t   test_server_nameRw   Rº   t   Xt   Ys   /override/homeRA   R¶   R·   t   run_oncet   file_wrappert   wsgi_s   wsgi.R&   s	   127.0.0.1s
   wsgi.inputs   wsgi.errorsi   i    s   wsgi.versions   wsgi.run_onceR~   s   wsgi.url_schemes   wsgi.multithreads   wsgi.multiprocesss   wsgi.file_wrapper(   RA   R¶   R·   RÅ   RÆ   (   i   i    (   R   t	   swap_attrR»   R   R@   t   getattrR#   R   R¡   t   updatet	   get_stdint
   get_stderrRI   RO   R   Rj   t   assertDictEqual(   R   Rº   t   handlert   attrt   expectedR^   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_wsgiref.pyt   testEnviron  s@    


	c         C   sG   t  d  d  d  i  ƒ } | j ƒ  x! d D] } |  j | | j ƒ q& Wd  S(   Ns   wsgi.url_schemes
   wsgi.inputs   wsgi.errors(   s   wsgi.url_schemes
   wsgi.inputs   wsgi.errors(   R   Rs   R   t   assertInR#   (   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_wsgiref.pyt   testCGIEnvironµ  s    
c         C   s^   t  d d ƒ } | j ƒ  |  j | j d d ƒ t  ƒ  } | j ƒ  |  j | j d d ƒ d  S(   NR�   R‚   s   wsgi.url_schemeR€   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_wsgiref.pyt
   testScheme»  s     
	 
c         C   sY   t  ƒ  } x3 d d d d g D] } |  j t t | | ƒ ƒ q W|  j t | j d ƒ d  S(   Nt   _flushRË   RÌ   t   add_cgi_varsR©   (   R   R­   t   NotImplementedErrorRÉ   t   _write(   R   Rª   t   name(    (    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_wsgiref.pyt   testAbstractMethodsÁ  s
    	c         C   s¬   d „  } d „  } d „  } t  ƒ  } | j | ƒ |  j | j j ƒ  d ƒ t  ƒ  } | j | ƒ |  j | j j ƒ  d ƒ t  ƒ  } | j | ƒ |  j | j j ƒ  d ƒ d  S(   Nc         S   s   | d g  ƒ |  d g S(   Ns   200 OKs   wsgi.url_scheme(    (   t   et   s(    (    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_wsgiref.pyt   trivial_app1Ì  s    c         S   s   | d g  ƒ |  d ƒ g  S(   Ns   200 OKs   wsgi.url_scheme(    (   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_wsgiref.pyt   trivial_app2Ð  s    c         S   s   | d d g ƒ g  S(   Ns   200 OKs   Content-Lengtht   12345(   s   Content-LengthRß   (    (   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_wsgiref.pyt   trivial_app4Ô  s    s)   Status: 200 OK
Content-Length: 4

https   Status: 200 OK

https)   Status: 200 OK
Content-Length: 12345

(   R»   t   runR@   t   stdoutR*   (   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_wsgiref.pyt   testContentLengthÉ  s    						c         C   sË   d „  } d „  } t  ƒ  } | j | ƒ |  j | j j ƒ  d ƒ |  j | j j ƒ  d ƒ t  ƒ  } | j | ƒ |  j | j j ƒ  d | j t | j ƒ | j f ƒ |  j	 | j j ƒ  j
 d ƒ d ƒ d  S(   Nc         S   s   | d g  ƒ g  S(   Ns   200 OK(    (   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_wsgiref.pyt   non_error_appò  s    c         S   s   t  d ƒ ‚ d  S(   Ns    This should be caught by handler(   R3   (   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_wsgiref.pyt	   error_appö  s    s%   Status: 200 OK
Content-Length: 0

R&   s>   Status: %s
Content-Type: text/plain
Content-Length: %d

%sR3   iÿÿÿÿ(   Rµ   Rá   R@   Râ   R*   R(   t   error_statusRž   t
   error_bodyt   assertNotEqualt   find(   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_wsgiref.pyt   testBasicErrorOutputð  s    				 c            sn   d ‰  ‡  f d †  } t  ƒ  } | j | ƒ |  j | j j ƒ  d ˆ  ƒ |  j | j j ƒ  j d ƒ d ƒ d  S(   Ns   Some output has been sentc            s#   | d g  ƒ ˆ  ƒ t  d ƒ ‚ d  S(   Ns   200 OKs    This should be caught by handler(   R3   (   RÛ   RÜ   (   t   MSG(    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_wsgiref.pyRå     s    s   Status: 200 OK

R3   iÿÿÿÿ(   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_wsgiref.pyt   testErrorAfterOutput  s    	c   	      C   sY  d „  } d } d } x=d D]5} | r2 d | p5 d } xd D]} xd D]ý } t d | ƒ } t | _ | | _ | | _ | j | ƒ |  j | | j j	 ƒ  ƒ t d | ƒ } t
 | _ | | _ | | _ | j | ƒ | d	 k r|  j | j j	 ƒ  d ƒ qL |  j t j | | | f | j j	 ƒ  ƒ | | | f | j j	 ƒ  f ƒ qL Wq? Wq Wd  S(   Nc         S   s   | d g  ƒ g  S(   Ns   200 OK(    (   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_wsgiref.pyRä     s    sf   HTTP/%s 200 OK\r\nDate: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n%sContent-Length: 0\r\n\r\ns%   Status: 200 OK
Content-Length: 0

s
   FooBar/1.0s   Server: %s
R&   s   1.0s   1.1s   HTTP/0.9s   HTTP/1.0s   HTTP/1.1Rz   (   s
   FooBar/1.0N(   s   1.0s   1.1(   s   HTTP/0.9s   HTTP/1.0s   HTTP/1.1(   Rs   R»   RI   t   origin_servert   http_versiont   server_softwareRá   R@   Râ   R*   RO   RL   t   reR:   (	   R   Rä   t   stdpatt   shortpatt   sswt   swRA   t   protoRª   (    (    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_wsgiref.pyt   testHeaderFormats  s.    							"c            sS   i t  d 6‰ d ‰  ‡  ‡ f d †  } t ƒ  } | j | ƒ |  j ˆ d t ƒ d  S(   Nt   close_calleds   Some output has been sentc            s6   | d g  ƒ ˆ  ƒ d t  f ‡ f d †  ƒ  Y} | ƒ  S(   Ns   200 OKt   CrashyIterablec              s    e  Z d  „  Z ‡  f d †  Z RS(   c         s   s"   x t  r d Vt d ƒ ‚ q Wd  S(   Nt   blahs    This should be caught by handler(   RO   R3   (   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_wsgiref.pyt   __iter__G  s    	c            s   t  ˆ  d <d  S(   NR÷   (   RO   (   R   (   t   side_effects(    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_wsgiref.pyRp   L  s    (   R   R   Rú   Rp   (    (   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_wsgiref.pyRø   F  s   	(   t   object(   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_wsgiref.pyRå   D  s    (   RI   Rµ   Rá   R@   RO   (   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_wsgiref.pyt   testCloseOnErrorA  s    	i   (   R   R   t   maxDiffRÑ   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_wsgiref.pyR½   {  s   	6				'			)c           C   s   t  j t ƒ d  S(   N(   R   t   run_unittestR   (    (    (    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_wsgiref.pyt	   test_mainU  s    t   __main__(&   t   unittestR    t   wsgiref.utilR   t   wsgiref.headersR   t   wsgiref.handlersR   R   t   wsgirefR   t   wsgiref.validateR   t   wsgiref.simple_serverR   R   R	   R
   t   SocketServerR   R¹   Rð   R'   R©   R   R   R   R%   R2   R>   R?   RP   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_wsgiref.pyt   <module>   s6   
		%* 8Ú	