ó
ŠwÛjc           @   s  d  Z  d d l m Z d d l Z d d l Z d d l Z d d d d d d	 d
 g Z d d d d d d d g Z e e d d g Z d e j	 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(   s   Test the binascii C module.iÿÿÿÿ(   t   test_supportNt
   b2a_base64t   b2a_hext   b2a_hqxt   b2a_qpt   b2a_uut   hexlifyt   rlecode_hqxt
   a2b_base64t   a2b_hext   a2b_hqxt   a2b_qpt   a2b_uut	   unhexlifyt   rledecode_hqxt   crc32t   crc_hqxt   BinASCIITestc           B   sµ   e  Z e Z d  Z e d j e e e d ƒ ƒ ƒ 7Z e d 7Z 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(   s.   The quick brown fox jumps over the lazy dog.
t    i   s   
Hello world.
c         C   s   |  j  |  j ƒ |  _ d  S(   N(   t	   type2testt   rawdatat   data(   t   self(    (    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_binascii.pyt   setUp   s    c         C   s6   |  j  t t j t ƒ ƒ |  j  t t j t ƒ ƒ d  S(   N(   t
   assertTruet
   issubclasst   binasciit   Errort	   Exceptiont
   Incomplete(   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_binascii.pyt   test_exceptions   s    c         C   sM   xF t  D]> } |  j t t t | ƒ d ƒ ƒ |  j t t t | ƒ ƒ q Wd  S(   Nt   __call__(   t   all_functionsR   t   hasattrt   getattrR   t   assertRaisest	   TypeError(   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_binascii.pyt   test_functions!   s    c      	   C   sj  d } |  j  |  } xt t t ƒ D]
\ } } t t | ƒ } t t | ƒ } y. | |  j | ƒ ƒ } | |  j | ƒ ƒ } Wn/ t k
 r¬ }	 |  j d j	 | | |	 ƒ ƒ n X| d k rÈ | \ } }
 n  |  j
 | | d j	 | | | | ƒ ƒ |  j | t ƒ |  j | t ƒ |  j t d „  | Dƒ ƒ d ƒ q# W|  j t j | d ƒ t ƒ |  j t j | ƒ t ƒ d  S(   Ni-   s   {}/{} conversion raises {!r}R   s   {}/{} conversion: {!r} != {!r}c         s   s   |  ] } t  | ƒ Vq d  S(   N(   t   ord(   t   .0t   c(    (    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_binascii.pys	   <genexpr>:   s    i€   i    (   R   t   zipt   a2b_functionst   b2a_functionsR"   R   R   R   t   failt   formatt   assertEqualt   assertIsInstancet   strt
   assertLesst   maxR   t   intR   (   R   t   MAX_ALLt   rawt   fat   fbt   a2bt   b2at   at   rest   errt   _(    (    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_binascii.pyt   test_returned_value'   s&     $c         C   sÁ   d } g  } x\ t  d t |  j ƒ | ƒ D]? } |  j |  j | | | !ƒ } t j | ƒ } | j | ƒ q( Wd } x6 | D]. } |  j | ƒ } t j | ƒ } | | } qx W|  j | |  j ƒ d  S(   Ni9   i    R   (	   t   ranget   lenR   R   R   R   t   appendR   R/   (   R   t
   MAX_BASE64t   linest   it   bR;   R<   t   line(    (    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_binascii.pyt   test_base64valid>   s    "c            sC  d } g  } x\ t  d t |  j ƒ | ƒ D]? } |  j |  j | | | !ƒ } t j | ƒ } | j | ƒ q( Wd ‰  d } x9 t d ƒ D]+ } t	 | ƒ } | | k r„ ˆ  | 7‰  q„ q„ W‡  f d †  } d }	 x? t
 | | ƒ D]. }
 |  j |
 ƒ } t j | ƒ } |	 | 7}	 qØ W|  j |	 |  j ƒ |  j t j |  j ˆ  ƒ ƒ d ƒ d  S(   Ni9   i    R   s@   abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/i   c            s”   ˆ  } t  |  ƒ t  | ƒ } d } xc |  r‡ | r‡ t  |  ƒ t  | ƒ | k re |  d |  d } }  n | d | d } } | | 7} q% W| | |  S(   NR   i    i   (   RA   (   RG   t   noiset   ratioR<   R)   (   t   fillers(    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_binascii.pyt   addnoise]   s    (   R@   RA   R   R   R   R   R   RB   t   xranget   chrt   mapR   R/   (   R   RC   RD   RE   RF   R;   t   validR)   RL   R<   RG   (    (   RK   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_binascii.pyt   test_base64invalidM   s(    "c         C   s€  d } g  } x\ t  d t |  j ƒ | ƒ D]? } |  j |  j | | | !ƒ } t j | ƒ } | j | ƒ q( Wd } x6 | D]. } |  j | ƒ } t j | ƒ } | | 7} qx W|  j	 | |  j ƒ |  j	 t j d ƒ d d ƒ |  j	 t j d ƒ d d ƒ |  j	 t j d	 ƒ d d ƒ |  j
 t j t j d
 ƒ |  j
 t j t j d ƒ |  j
 t j t j d d ƒ |  j	 t j d ƒ d ƒ d  S(   Ni-   i    R   s   s    i   s   €i    s   ÿs   ÿ s   !!!!i.   t   !t   xs   !>   
(   R@   RA   R   R   R   R   R   RB   R   R/   R#   R   (   R   t   MAX_UURD   RE   RF   R;   R<   RG   (    (    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_binascii.pyt   test_uus   s&    "c         C   s|   t  j |  j d ƒ d ƒ } t  j |  j d ƒ | ƒ } |  j | d ƒ |  j t t  j ƒ |  j t t  j |  j d ƒ ƒ d  S(   Ns   Test the CRC-32 ofi    s    this string.iÒ7  R   (   R   R   R   R/   R#   R$   (   R   t   crc(    (    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_binascii.pyt   test_crc_hqxŒ   s
    c         C   sZ   t  j |  j d ƒ ƒ } t  j |  j d ƒ | ƒ } |  j | d ƒ |  j t t  j ƒ d  S(   Ns   Test the CRC-32 ofs    this string.ijë¦](   R   R   R   R/   R#   R$   (   R   RV   (    (    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_binascii.pyt
   test_crc32”   s    c         C   sn   t  j |  j ƒ } t  j |  j | ƒ ƒ } t  j |  j | ƒ ƒ \ } } t  j | ƒ } |  j | |  j ƒ d  S(   N(	   R   R   R   R   R   R
   R   R/   R   (   R   t   rleR;   RF   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_binascii.pyt   test_hqx›   s
    c         C   s°   d } t  j |  j | ƒ ƒ } t  j |  j | ƒ ƒ } |  j | | ƒ |  j t t  j | d  ƒ |  j t t  j | d  d ƒ t j r¬ |  j t  j	 t
 d d ƒ ƒ d ƒ n  d  S(   Ns    {s   worldi   s   helloi   0iÿÿÿÿt   qR;   t   asciit   61(   R   R   R   R	   R/   R#   R$   R    t   have_unicodeR   t   unicode(   R   t   st   tt   u(    (    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_binascii.pyt   test_hex¥   s    	c         C   s‰  |  j  } t j } t j } | d d d t ƒ y | d i d d 6� Wn t k
 rY n X|  j d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d	 ƒ ƒ d
 ƒ |  j | | d ƒ ƒ d
 ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ d  ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ d t ƒd ƒ |  j	 t | d d ƒ|  j | | d ƒ ƒ d ƒ |  j | | d ƒ ƒ d ƒ |  j | | d d d  ƒ ƒ d d d! ƒ |  j | | d" ƒ ƒ d# ƒ |  j | | d ƒ ƒ d$ ƒ |  j | | d ƒ ƒ d ƒ |  j | | d ƒ d t ƒd% ƒ |  j | | d& ƒ d t ƒd' ƒ |  j | | d( ƒ d t ƒd) ƒ |  j | | d& ƒ d t d* t ƒd+ ƒ |  j | | d, ƒ d t ƒd, ƒ |  j | | d ƒ ƒ d- ƒ |  j | | d. ƒ ƒ d/ ƒ |  j | | d0 ƒ ƒ d0 ƒ |  j | | d1 ƒ ƒ d1 ƒ |  j | | d0 ƒ d  ƒ d- ƒ |  j | | d1 ƒ d  ƒ d/ ƒ |  j | | d2 ƒ ƒ d3 ƒ |  j | | d4 ƒ ƒ d5 ƒ |  j | | d4 ƒ d* t ƒd5 ƒ |  j | | d6 ƒ ƒ d6 ƒ |  j | | d6 ƒ d* t ƒd7 ƒ |  j | | d6 ƒ d8 t ƒd6 ƒ |  j | | d9 ƒ ƒ d: ƒ |  j | | d9 ƒ d* t ƒd: ƒ |  j | | d9 ƒ d8 t ƒd; ƒ |  j | | d< ƒ ƒ d< ƒ |  j | | d< ƒ d* t ƒd= ƒ |  j | | d< ƒ d8 t ƒd> ƒ |  j | | d? ƒ ƒ d@ ƒ |  j | | d? ƒ d* t ƒd@ ƒ |  j | | d? ƒ d8 t ƒdA ƒ |  j | | dB ƒ d  ƒ dC ƒ |  j | | dD ƒ d  ƒ dE ƒ |  j | | dB ƒ d  d* t ƒdF ƒ |  j | | dD ƒ d  d* t ƒdG ƒ |  j | | dB ƒ d  d8 t ƒdH ƒ |  j | | dD ƒ d  d8 t ƒdI ƒ |  j | | dJ ƒ ƒ dK ƒ |  j | | dL ƒ ƒ dM ƒ |  j | | dN ƒ ƒ dO ƒ |  j | | dP ƒ ƒ dQ ƒ |  j | | dR ƒ ƒ dR ƒ |  j | | dS ƒ d  ƒ dK ƒ d  S(T   NR   R   t   headeri   s/   binascii.a2b_qp(**{1:1}) didn't raise TypeErrort   =s   = s   ==s   =
ABt   ABs   =
ABs   =ABs   =AB
CDt   CDs   =ABs   «s   =abs   =AXs   =XAiÿÿÿÿs   =AR>   t    t   foot   bars   =00
=00s    
 s   ÿ
ÿ
ÿs   =FF
=FF
=FFt   0iK   s   ÿ
ÿ
ÿs   =
=FF
=FF
=FFs   s   =7Fs   =3Ds   =5Fs   x yt   x_ys   x s   x=20t	   quotetabss   x=20ys   x	ys   =20s   	s   =09s    xs   	xs    s   =00s    
s   =00
s   x y	zs	   x=20y=09zt   istexts   x 
y	
s
   x=20
y=09
s
   x =0Ay	=0As   x y	s
   x=20y=09s
   x =0Dy	=0Ds   x 
y	
s   x=20
y=09
s   x =0D=0Ay	=0D=0As   x 
s   x s   x	
s   x	s   x=20s   x=09s   x =0Ds   x	=0Dt   .s   =2Es   .
s   =2E
s   .s   =2Es   . s   =2E=00s   a.
s   .a(
   R   R   R   R   t   FalseR$   R-   R/   t   TrueR#   (   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_binascii.pyt   test_qp²   s¬    			 """"!"  "  c         C   s•   |  j  d ƒ } x t D]w } | d k r> t j | d ƒ q n  t t | ƒ } y | | ƒ Wq t k
 rŒ } |  j d j | | | ƒ ƒ q Xq Wd  S(   NR   R   i    s   {}({!r}) raises {!r}(   R   R    R   R   R"   R   R-   R.   (   R   t   emptyt   funct   fR=   (    (    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_binascii.pyt   test_empty_string  s    (   t   __name__t
   __module__R1   R   R   t   joinRO   RN   RM   R   R   R&   R?   RH   RQ   RU   RW   RX   RZ   Rc   Rr   Rv   (    (    (    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_binascii.pyR      s"   "
						&				
		ft   ArrayBinASCIITestc           B   s   e  Z d  „  Z RS(   c         C   s   t  j  d | ƒ S(   NR)   (   t   array(   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_binascii.pyR   (  s    (   Rw   Rx   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_binascii.pyRz   '  s   t   BytearrayBinASCIITestc           B   s   e  Z e Z RS(    (   Rw   Rx   t	   bytearrayR   (    (    (    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_binascii.pyR|   ,  s   t   MemoryviewBinASCIITestc           B   s   e  Z e Z RS(    (   Rw   Rx   t
   memoryviewR   (    (    (    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_binascii.pyR~   0  s   c           C   s   t  j t t t t ƒ d  S(   N(   R    t   run_unittestR   Rz   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_binascii.pyt	   test_main4  s    	t   __main__(   t   __doc__t   testR    t   unittestR   R{   R,   R+   R    t   TestCaseR   Rz   R|   R~   R�   Rw   (    (    (    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_binascii.pyt   <module>   s"   ÿ 	