mò
­fIc           @   s7  d  k  Z  d  k Z d  k Z d  k Z d  k Z d  k Z d  k Z d k l Z l	 Z	 l
 Z
 l Z d k l Z d k l Z l Z l Z d  k Z d „  Z e i ƒ  Z e e e ƒ Z d Z d Z d Z d Z e i i d	 e i d
 ƒ Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z  e! d j o e  ƒ  n d  S(   N(   s   ZipFiles   ZipInfos
   ZIP_STOREDs   ZIP_DEFLATED(   s   test_support(   s   ImportHooksBaseTestCases   test_srcs   test_coc         C   sŠ   t  i |  ƒ } t | ƒ t d ƒ j o8 | d j  o t | ƒ } q` t d t | ƒ ƒ } n t i	 ƒ  t
 i d t | ƒ ƒ | } | S(   Nf0.0iÿÿÿl        s   <i(   t   marshalt   dumpst   cot   datat   typet   mtimet   intt   longt   impt	   get_magict   structt   packt   pyc(   R   R   R   R   (    (    t0   /mit/python/lib/python2.4/test/test_zipimport.pyt   make_pyc   s    &s   .pyot   ziptestmodulet   ziptestpackaget   ziptestpackage2t	   junk95142t   zipt   UncompressedZipImportTestCasec           B   s•   t  Z 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 RS(   Nc         C   s   t  i i ƒ  t i |  ƒ d  S(   N(   t	   zipimportt   _zip_directory_cachet   cleart   ImportHooksBaseTestCaset   setUpt   self(   R   (    (    R   R   .   s    c         O   s‚  t  t d ƒ } zTxT | i ƒ  D]F \ }	 \ } } t |	 t	 i
 | ƒ ƒ } |  i | _ | i | | ƒ q W| i ƒ  | i d d  ƒ } | d  j	 o\ t t d ƒ }
 |
 i ƒ  } |
 i ƒ  t t d ƒ }
 |
 i | ƒ |
 i | ƒ |
 i ƒ  n t i i d t ƒ t d i | ƒ t ƒ  t  ƒ  d g ƒ } | o3 | i# ƒ  } |  i% | t& i i t | Œ | ƒ n Wd  | i ƒ  t& i' t ƒ Xd  S(   Nt   wt   stufft   rbt   wbi    t   .t	   __dummy__((   t   ZipFilet   TEMP_ZIPt   zt   filest   itemst   nameR   R   t   ZipInfot   timet	   localtimet   zinfoR   t   compressiont   compress_typet   writestrt   closet   kwt   gett   NoneR   t   opent   ft   readt   writet   syst   patht   insertt
   __import__t   joint   modulest   globalst   localst   modt   expected_extt   get_filet   filet   assertEqualst   ost   remove(   R   R?   R$   R;   R/   RA   R   R   R>   R&   R3   R*   R   R#   (    (    R   t   doTest4   s4     

+ 
c         C   s¾   d t  i j o d  Sn d t  i j o t  i d =n h  d t t f <} y |  i d | d ƒ Wn4 t j
 o( |  i	 t
 j o |  i d ƒ qº n# X|  i	 t j o |  i d ƒ n d  S(   Nt   zlibs   zlib.pys   .pys&   expected test to not raise ImportErrors"   expected test to raise ImportError(   R6   t   builtin_module_namesR;   t   NOWt   test_srcR$   R   RE   t   ImportErrorR+   t   ZIP_DEFLATEDt   failt
   ZIP_STORED(   R   R$   (    (    R   t   testAFakeZlibU   s    c         C   s0   h  t  d t t f <} |  i d | t  ƒ d  S(   Ns   .py(   t   TESTMODRH   RI   R$   R   RE   (   R   R$   (    (    R   t   testPyu   s    c         C   s0   h  t  t t t f <} |  i t | t  ƒ d  S(   N(   RO   t   pyc_extRH   t   test_pycR$   R   RE   (   R   R$   (    (    R   t   testPycy   s    c         C   sC   h  t  d t t f <t  t t t f <} |  i t | t  ƒ d  S(   Ns   .py(   RO   RH   RI   RQ   RR   R$   R   RE   (   R   R$   (    (    R   t   testBoth}   s    ,c         C   s0   h  t  d t d f <} |  i d  | t  ƒ d  S(   Ns   .pyt    (   RO   RH   R$   R   RE   R1   (   R   R$   (    (    R   t   testEmptyPy‚   s    c         C   sq   t  t d ƒ } | d N} t | ƒ t d } h  t d t t f <t t t | f <} |  i d | t ƒ d  S(   Ni    i   i   s   .py(   t   ordRR   t   m0t   chrt   badmagic_pycRO   RH   RI   RQ   R$   R   RE   (   R   R$   RX   RZ   (    (    R   t   testBadMagic†   s
    
,c         C   s…   t  t d ƒ } | d N} t | ƒ t d } h  t t t | f <} y |  i
 d | t ƒ Wn t j
 o n X|  i d ƒ d  S(   Ni    i   i   s   .pys)   expected ImportError; import from bad pyc(   RW   RR   RX   RY   RZ   RO   RQ   RH   R$   R   RE   RJ   RL   (   R   R$   RX   RZ   (    (    R   t   testBadMagic2   s    
c         C   sy   t  t d ƒ } | d N} t d  t | ƒ t d } h  t d t t f <t t t | f <} |  i d | t ƒ d  S(   Ni   i   i   s   .py(   RW   RR   t   t3RY   t   badtime_pycRO   RH   RI   RQ   R$   R   RE   (   R   R$   R]   R^   (    (    R   t   testBadMTimeœ   s
    
,c         C   s[   t  t i } h  | d t t t f <| t t t t f <} |  i
 t | t  t ƒ d  S(   Nt   __init__(   t   TESTPACKRC   t   sept   packdirRQ   RH   RR   RO   R$   R   RE   (   R   R$   Rc   (    (    R   t   testPackage¥   s    4c         C   s†   t  t i } | t t i } h  | d t t t f <| d t t t f <| t	 t t t f <} |  i t | t  t t	 ƒ d  S(   NR`   (   Ra   RC   Rb   Rc   t	   TESTPACK2t   packdir2RQ   RH   RR   RO   R$   R   RE   (   R   R$   Rc   Rf   (    (    R   t   testDeepPackage«   s    Kc         C   sÀ   t  t d ƒ } |  i | _ z† d } d i g  } t d ƒ D] } | t
 | ƒ q; ~ ƒ d } | i | | ƒ | i ƒ  t i t ƒ } |  i | | i | ƒ ƒ Wd  | i ƒ  t i t ƒ Xd  S(   NR   s   testdata.datRU   i   iô  (   R!   R"   R#   R   R+   R&   R:   t   _[1]t   ranget   xRY   R   R-   R.   R   t   zipimportert   ziRB   t   get_dataRC   RD   (   R   R&   Rh   Rj   R#   R   Rl   (    (    R   t   testGetData³   s    :
 
c         C   s`   d } t t | d d ƒ t ƒ } h  t t t | f <d t d f <} |  i	 t | t ƒ d  S(   Ns²   if 1:  # indent hack
        def get_file():
            return __file__
        if __loader__.get_data("some.data") != "some data":
            raise AssertionError, "bad data"
s   <???>t   execs	   some.datas	   some data(
   t   srcR   t   compileRH   R   RO   RQ   R$   R   RE   (   R   R$   Rp   R   (    (    R   t   testImporterAttrÁ   s    (c         C   s:   h  t  d t t f <} |  i d | t  d d d ƒd  S(   Ns   .pyR   s
   Some Stuffi   (   RO   RH   RI   R$   R   RE   (   R   R$   (    (    R   t   testImport_WithStuffÌ   s    (   t   __name__t
   __module__RM   R+   R   RE   RN   RP   RS   RT   RV   R[   R\   R_   Rd   Rg   Rn   Rr   Rs   (    (    (    R   R   *   s    		!	 													t   CompressedZipImportTestCasec           B   s   t  Z e Z RS(   N(   Rt   Ru   RK   R+   (    (    (    R   Rv   Ó   s   c           C   s   t  i t t ƒ d  S(   N(   t   test_supportt   run_unittestR   Rv   (    (    (    R   t	   test_main×   s    	t   __main__("   R6   RC   R    R   R
   R(   RF   t   zipfileR!   R'   RM   RK   t   testRw   t   test.test_importhooksR   RI   t   test_coR   R   RH   RR   RQ   RO   Ra   Re   R7   t   abspatht   extsepR"   R   Rv   Ry   Rt   (   Rw   RI   R!   R"   R   RK   R
   R   Re   RO   R   Ry   RQ   R   R   R~   RM   R6   RR   Ra   R'   RF   Rv   R(   RH   RC   R    (    (    R   t   ?   s0   									 ©	