Ñò
‘à"Ic           @   sæ  d  d k  Td  d k Z d  d k Z d  d k Z d  d k l Z d Z d d e f d d e f d	 d
 e	 f d d d d d g e
 f d d e d ƒ d e f d d d* e f d d d+ e f g Z e i oŒ e e d ƒ e d ƒ e f d e d
 ƒ e	 f d e d ƒ e d ƒ e d ƒ e d ƒ g e
 f d e d  ƒ e d! ƒ d d g e
 f g 7Z n d" e i f d# „  ƒ  YZ d$ „  Z e d% j o] y$ e i e i i d& ƒ d e _ Wn+ e e f j
 o d' Gd( GHd e _ n Xe ƒ  n d S(,   iÿÿÿÿ(   t   *N(   t   test_supports-   SOFTWARE\Python Registry Test Key - Delete Mes	   Int Valuei-   s
   String Vals   A string valuet   StringExpands   The path is %path%s   Multi-stringt   Lotst   oft   stringt   valuess   Raw Datat   binaryi    t   datas
   Big Stringt   xi   i   i   s
   Big Binarys   Unicode Vals   A Unicode valuet   UnicodeExpands   Multi-unicodet   unicodes   Multi-mixedt   Unicodet   andt   WinregTestsc           B   sV   e  Z d Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z RS(	   c      
   C   so  t  | t t d ƒ t | t ƒ } t | d ƒ } x- t D]% \ } } } t | | d | | ƒ q8 Wt | ƒ \ } } }	 |  i | d d ƒ |  i | d d ƒ t | ƒ \ } } }	 |  i | d d ƒ |  i | t t ƒ d ƒ t	 | ƒ }
 t
 | ƒ y t |
 ƒ |  i d ƒ Wn t j
 o n Xt	 | ƒ } | i ƒ  y t | ƒ |  i d ƒ Wn t j
 o n Xd  S(	   Ns   Default valuet   sub_keyi    i   s"   Not the correct number of sub keyss    Not the correct number of valuessA   It appears the CloseKey() function does not close the actual key!sB   It appears the key.Close() function does not close the actual key!(   t   SetValuet   test_key_namet   REG_SZt	   CreateKeyt	   test_datat
   SetValueExt   QueryInfoKeyt   assertEqualst   lent   intt   CloseKeyt   failt   EnvironmentErrort   Close(   t   selft   root_keyt   keyR   t
   value_namet
   value_datat
   value_typet   nkeyst   nvaluest	   since_modt   int_sub_keyt   int_key(    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   WriteTestData#   s6     



c         C   s’  t  | t ƒ } |  i | d d ƒ t | t ƒ } t | d ƒ i i ƒ  } zÔ | ~ } d } xP y t | | ƒ } Wn t j
 o Pn X|  i | t j t	 d ƒ | d } q` |  i | t
 t ƒ d ƒ xR t D]J \ } }	 }
 t | | ƒ \ } } |  i | |	 d ƒ |  i | |
 d ƒ qÐ WWd  QX| i ƒ  t | d ƒ } |  i | d d	 ƒ y t | d ƒ |  i d
 ƒ Wn t j
 o n X| i ƒ  d  S(   Ns   Default values+   Registry didn't give back the correct valueR   i    s&   Didn't read back the correct test datai   s'   Didn't read the correct number of itemss!   Could not directly read the values   Read subkey value wrongs2   Was able to get a second key when I only have one!(   t
   QueryValueR   R   t   OpenKeyt   __exit__t	   __enter__t	   EnumValueR   R   t   TrueR   t   QueryValueExR   t   EnumKeyR   (   R   R   t   valR    t   _[1]R   t   indexR   R!   R"   R#   t   read_valt   read_typ(    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   ReadTestDataK   s@    & 
c   
      C   s(  t  | t d t ƒ } t  | d d t ƒ } x$ t D] \ } } } t | | ƒ q1 Wt | ƒ \ } } }	 |  i | d d ƒ |  i | d d ƒ | i ƒ  t | d ƒ y t | d ƒ |  i	 d ƒ Wn t
 j
 o n X| i ƒ  t | t ƒ y  t  | t ƒ } |  i	 d ƒ Wn t j
 o n Xd  S(   Ni    R   s   subkey not empty before deletes    Deleting the key twice succeededs   Could open the non-existent key(   R+   R   t   KEY_ALL_ACCESSR   t   DeleteValueR   R   R   t	   DeleteKeyR   R   t   WindowsError(
   R   R   R    R   R!   R"   R#   R$   R%   R&   (    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   DeleteTestDatas   s,     

c         C   s+   |  i  | ƒ |  i | ƒ |  i | ƒ d  S(   N(   R)   R7   R<   (   R   R   (    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   TestAll‘   s    c         C   s   |  i  t ƒ d  S(   N(   R=   t   HKEY_CURRENT_USER(   R   (    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   testLocalMachineRegistryWorks–   s    c         C   s   t  d  t ƒ } | i ƒ  d  S(   N(   t   ConnectRegistryt   Nonet   HKEY_LOCAL_MACHINER   (   R   t   h(    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt&   testConnectRegistryToLocalMachineWorks™   s    c         C   s2   |  i  p d  St |  i  t ƒ } |  i | ƒ d  S(   N(   t   remote_nameR@   R>   R=   (   R   t
   remote_key(    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   testRemoteMachineRegistryWorksž   s    
c         C   sA   t  d ƒ } |  i t | ƒ t ƒ |  i | t i d d ƒ d  S(   Nu   %windir%\testt   windirs   \test(   t   ExpandEnvironmentStringst   assertEqualt   typeR   t   ost   environ(   R   t   r(    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   testExpandEnvironmentStrings¤   s    N(   t   __name__t
   __module__RA   RE   R)   R7   R<   R=   R?   RD   RG   RO   (    (    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyR       s   	(	(					c           C   s   t  i t ƒ d  S(   N(   R   t   run_unittestR   (    (    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt	   test_main©   s    t   __main__s   --remotes)   Remote registry calls can be tested usings(   'test_winreg.py --remote \\machine_name'i @  iÿ?  i @  (   t   _winregRL   t   syst   unittestt   testR   R   t	   REG_DWORDR   t   REG_EXPAND_SZt   REG_MULTI_SZt   chrt
   REG_BINARYR   t   have_unicodeR   t   TestCaseR   RS   RP   t   argvR4   RE   t
   IndexErrort
   ValueErrorRA   (    (    (    s-   /mit/python/lib/python2.6/test/test_winreg.pyt   <module>   s:   

‰	$