mς
­fIc           @   s~   d  Z  d k Z d k Z d k Z d k l Z e i Z d   Z d e i	 f d     YZ
 d   Z e d j o e   n d S(   sA   Test script for the dumbdbm module
   Original by Roger E. Masse
N(   s   test_supportc          C   sI   xB d d d g D]1 }  y t i t |   Wq t j
 o q Xq Wd  S(   Ns   .dirs   .dats   .bak(   t   extt   ost   unlinkt   _fnamet   OSError(   R    (    (    t.   /mit/python/lib/python2.4/test/test_dumbdbm.pyt   _delete_files   s     t   DumbDBMTestCasec           B   sΛ   t  Z h  d d <d d <d d <d d <d	 d
 <d d <d 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(   Nt   0t    t   as   Python:t   bt   Programmingt   ct   thet   dt   wayt   ft   Guidot   gt   intendedc         G   s   t  i i |  |  d  S(   N(   t   unittestt   TestCaset   __init__t   selft   args(   R   R   (    (    R   R      s    c         C   sh   t  i t d  } |  i | i   g   x" |  i D] } |  i | | | <q2 W|  i	 |  | i
   d  S(   NR   (   t   dumbdbmt   openR   R   R   t   assertEqualt   keyst   _dictt   keyt   read_helpert   close(   R   R   R   (    (    R   t   test_dumbdbm_creation!   s    
 c         C   sE   t  i t  } d | d <|  i | d d  | i   | i   d  S(   NR   R
   (   R   R   R   R   R   R   R!   (   R   R   (    (    R   t   test_close_twice)   s
    

c         C   sL   |  i   t i t d  } d |  i d <| d <|  i |  | i   d  S(   Nt   wt   indentedR   (	   R   t   init_dbR   R   R   R   R   R    R!   (   R   R   (    (    R   t   test_dumbdbm_modification0   s
    
c         C   s7   |  i   t i t d  } |  i |  | i   d  S(   Nt   r(   R   R&   R   R   R   R   R    R!   (   R   R   (    (    R   t   test_dumbdbm_read7   s    
c         C   s6   |  i   t i t  } |  i |  } | i   d  S(   N(	   R   R&   R   R   R   R   t   keys_helperR   R!   (   R   R   R   (    (    R   t   test_dumbdbm_keys=   s    
c         C   s^   t  i t  } d | d <d | d <| i   t  i t  } |  i | d d  | i   d  S(   Nt   hellot   1t   hello2(   R   R   R   R   R!   R   R   (   R   R   (    (    R   t   test_write_write_readC   s    


c         C   sͺ   t  i t  } d | d <d | d <| i   t t d  i   } | i d d  } t t d d  i |  t  i t  } |  i
 | d d  |  i
 | d d  d  S(	   NR,   R-   R.   t   2s   .dirs   
s   
t   wb(   R   R   R   R   R!   t   readt   datat   replacet   writeR   R   (   R   R   R3   (    (    R   t   test_line_endingsM   s    


c         C   sB   |  i |  } x, |  i D]! } |  i |  i | | |  q Wd  S(   N(   R   R*   R   R   R   R   R   (   R   R   R   R   (    (    R   R    _   s    
 c         C   sE   t  i t d  } x" |  i D] } |  i | | | <q W| i   d  S(   NR$   (   R   R   R   R   R   R   t   kR!   (   R   R7   R   (    (    R   R&   d   s
    
 c         C   sC   | i   } | i   |  i i   } | i   |  i | |  | S(   N(   R   R   t   sortR   R   t   dkeysR   (   R   R   R   R9   (    (    R   R*   j   s    

c   	      C   s8  d  k  } h  } x"t d  D]} t i t  } x t d  D] } | i d  } | i    d j  o# | | j o | | =| | =qΝ q> | i d  | i
 d  } | | | <| | | <|  i | | |  q> W| i   t i t  } | i   } | i   | i   } | i   |  i | |  | i   q Wd  S(   Ni   id   t   abcdefghijklmf0.20000000000000001t   abci'  (   t   randomR   t   ranget   dummyR   R   R   R   t   choiceR7   t	   randranget   vR   R   R!   t   itemst   expectedR8   t   got(	   R   R>   R   R   R<   RA   RC   RD   R7   (    (    R   t   test_randomt   s0    	  




c         C   s   t    d  S(   N(   R   (   R   (    (    R   t   tearDown   s    c         C   s   t    d  S(   N(   R   (   R   (    (    R   t   setUp   s    (   t   __name__t
   __module__R   R   R"   R#   R'   R)   R+   R/   R6   R    R&   R*   RE   RF   RG   (    (    (    R   R      s   E								
				
		c           C   s    z t  i t  Wd  t   Xd  S(   N(   t   test_supportt   run_unittestR   R   (    (    (    R   t	   test_main   s     t   __main__(   t   __doc__R   R   R   t   testRJ   t   TESTFNR   R   R   R   RL   RH   (   RJ   R   R   R   R   RL   R   R   (    (    R   t   ?   s   						