ó
‹wÛjc           @   sm   d  Z  d d l Z d d l m Z e j d ƒ Z d e j f d „  ƒ  YZ d „  Z e	 d k ri e ƒ  n  d S(	   s   Test script for the grp module.iÿÿÿÿN(   t   test_supportt   grpt   GroupDatabaseTestCasec           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   sÈ   |  j  t | ƒ d ƒ |  j  | d | j ƒ |  j | j t ƒ |  j  | d | j ƒ |  j | j t ƒ |  j  | d | j ƒ |  j | j t t f ƒ |  j  | d | j	 ƒ |  j | j	 t
 ƒ d  S(   Ni   i    i   i   i   (   t   assertEqualt   lent   gr_namet   assertIsInstancet
   basestringt	   gr_passwdt   gr_gidt   longt   intt   gr_memt   list(   t   selft   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_grp.pyt   check_value
   s    c         C   s.   t  j ƒ  } x | D] } |  j | ƒ q Wd  S(   N(   R   t   getgrallR   (   R   t   entriest   e(    (    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_grp.pyt   test_values   s    c         C   sà   t  j ƒ  } t | ƒ d k r. |  j d ƒ n  x« | D]£ } t  j | j ƒ } |  j | ƒ |  j | j | j ƒ | j } | j	 d ƒ s5 | j	 d ƒ r� q5 n  t  j
 | ƒ } |  j | ƒ |  j | j j ƒ  | j ƒ  ƒ q5 Wd  S(   Niè  s&   huge group file, extended test skippedt   +t   -(   R   R   R   t   skipTestt   getgrgidR	   R   R   R   t
   startswitht   getgrnamt   lower(   R   R   R   t   e2t   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_grp.pyt   test_values_extended   s    	c         C   sÖ  |  j  t t j ƒ |  j  t t j ƒ |  j  t t j d ƒ i  } i  } xM t j ƒ  D]? \ } } } } | sU | d k r€ qU n  | | | <| | | <qU W| j ƒ  } d } | | }	 xÈ |	 | k r~t |	 ƒ }
 xš t t	 |
 ƒ ƒ D]Y } |
 | d k rd |
 | <Pqâ |
 | d k rqâ qâ t
 t |
 | ƒ d ƒ |
 | <Pqâ W| d } y | | }	 Wn t k
 rkPn Xd j |
 ƒ }	 q· W|  j  t t j |	 ƒ d	 } x | | k r»| d
 d } qžW|  j  t t j | ƒ d  S(   Ni*   R   i    t   zt   At   Zi   t    i  i   i   (   t   assertRaisest	   TypeErrorR   R   R   R   t   keysR   t   xrangeR   t   chrt   ordt
   IndexErrort   joint   KeyError(   R   t   bynamest   bygidst   nt   pt   gt   memt   allnamest   nameit   fakenamet   charst   it   fakegid(    (    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_grp.pyt   test_errors1   sD    



(   t   __name__t
   __module__R   R   R   R8   (    (    (    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_grp.pyR      s   			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_grp.pyt	   test_main_   s    t   __main__(
   t   __doc__t   unittestt   testR    t   import_moduleR   t   TestCaseR   R<   R9   (    (    (    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_grp.pyt   <module>   s   W	