ó
‰wÛjc           @   sá   d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d e
 f d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z d	 d d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   findfilet   TESTFNt   unlinkNt   UnseekableIOc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   t  j ‚ d  S(   N(   t   iot   UnsupportedOperation(   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/audiotests.pyt   tell
   s    c         O   s   t  j ‚ d  S(   N(   R   R   (   R   t   argst   kwargs(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt   seek   s    (   t   __name__t
   __module__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/audiotests.pyR   	   s   	c         C   s   t  j |  j d d ƒ ƒ S(   Nt    t    (   t   base64t	   b16decodet   replace(   t   s(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt   fromhex   s    c         C   s0   t  j  d ƒ } | j |  ƒ | j ƒ  | j ƒ  S(   Nt   h(   t   arrayt
   fromstringt   byteswapt   tostring(   t   datat   a(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt	   byteswap2   s    
c         C   sV   t  |  ƒ } |  d d  d … | d  d  d … <|  d  d  d … | d d  d … <t | ƒ S(   Ni   i   (   t	   bytearrayt   bytes(   R   t   ba(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt	   byteswap3   s      c         C   s0   t  j  d ƒ } | j |  ƒ | j ƒ  | j ƒ  S(   Nt   i(   R   R   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/audiotests.pyt	   byteswap4   s    
t
   AudioTestsc           B   s)   e  Z e Z d  „  Z d „  Z d „  Z RS(   c         C   s   d  |  _ |  _ d  S(   N(   t   Nonet   ft   fout(   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/audiotests.pyt   setUp)   s    c         C   sL   |  j  d  k	 r |  j  j ƒ  n  |  j d  k	 r> |  j j ƒ  n  t t ƒ d  S(   N(   R$   R#   t   closeR%   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/audiotests.pyt   tearDown,   s
    c         C   sÿ   |  j  | j ƒ  | ƒ |  j  | j ƒ  | ƒ |  j  | j ƒ  | ƒ |  j  | j ƒ  | ƒ |  j  | j ƒ  | ƒ |  j  | j ƒ  | ƒ | j ƒ  } |  j  | | | | | | | f ƒ xF t t	 j
 d ƒ D]1 }	 t	 j | |	 ƒ }
 |  j  t	 j |
 ƒ | ƒ qÆ Wd  S(   Ni   (   t   assertEqualt   getnchannelst   getsampwidtht   getframeratet
   getnframest   getcomptypet   getcompnamet	   getparamst   ranget   picklet   HIGHEST_PROTOCOLt   dumpst   loads(   R   R$   t	   nchannelst	   sampwidtht	   frameratet   nframest   comptypet   compnamet   paramst   protot   dump(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt   check_params3   s    	(   R   R   t   Falset   close_fdR&   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/audiotests.pyR"   &   s   		t   AudioWriteTestsc           B   sk   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z RS(   c         C   sf   |  j  j | d ƒ } |  _ | j |  j ƒ | j |  j ƒ | j |  j ƒ | j	 |  j
 |  j ƒ | S(   Nt   wb(   t   modulet   openR%   t   setnchannelsR6   t   setsampwidthR7   t   setframerateR8   t   setcomptypeR:   R;   (   R   t   testfileR$   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt   create_fileG   s    c         C   s¥   |  j  j | d ƒ } z~ |  j | j ƒ  |  j ƒ |  j | j ƒ  |  j ƒ |  j | j ƒ  |  j ƒ |  j | j	 ƒ  | ƒ |  j | j
 | ƒ | ƒ Wd  | j ƒ  Xd  S(   Nt   rb(   RD   RE   R)   R*   R6   R+   R7   R,   R8   R-   t
   readframesR'   (   R   RJ   R9   t   framesR$   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt
   check_fileO   s    c         C   sn   |  j  t ƒ } | j |  j ƒ | j |  j ƒ |  j | |  j |  j |  j	 |  j |  j
 |  j ƒ | j ƒ  d  S(   N(   RK   R   t
   setnframesR9   t   writeframesRN   R?   R6   R7   R8   R:   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/audiotests.pyt   test_write_paramsZ   s    c         C   sV   |  j  t ƒ } | j |  j ƒ | j |  j ƒ | j ƒ  |  j t |  j |  j ƒ d  S(   N(   RK   R   RP   R9   RQ   RN   R'   RO   (   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/audiotests.pyt
   test_writeb   s
    
c      	   C   s°   t  t d ƒ �Q } | j d ƒ |  j | ƒ } | j |  j d ƒ | j |  j ƒ | j ƒ  Wd  QXt  t d ƒ �9 } |  j	 | j
 d ƒ d ƒ |  j | |  j |  j ƒ Wd  QXd  S(   NRC   t   ababagalamagai   RL   i   (   RE   R   t   writeRK   RP   R9   RQ   RN   R'   R)   t   readRO   (   R   RJ   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/audiotests.pyt   test_incompleted_writej   s    c      	   C   sÖ   t  t d ƒ �w } | j d ƒ |  j | ƒ } | j |  j ƒ |  j |  j } | j |  j	 |  ƒ | j |  j	 | ƒ | j
 ƒ  Wd  QXt  t d ƒ �9 } |  j | j d ƒ d ƒ |  j | |  j |  j	 ƒ Wd  QXd  S(   NRC   RT   RL   i   (   RE   R   RU   RK   RP   R9   R6   R7   RQ   RN   R'   R)   RV   RO   (   R   RJ   R$   t	   framesize(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt   test_multiple_writesv   s    c      	   C   s°   t  t d ƒ �Q } | j d ƒ |  j | ƒ } | j |  j d ƒ | j |  j ƒ | j ƒ  Wd  QXt  t d ƒ �9 } |  j	 | j
 d ƒ d ƒ |  j | |  j |  j ƒ Wd  QXd  S(   NRC   RT   i   RL   i   (   RE   R   RU   RK   RP   R9   RQ   RN   R'   R)   RV   RO   (   R   RJ   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/audiotests.pyt   test_overflowed_write„   s    c         C   sn   |  j  t ƒ } | j |  j ƒ | j |  j ƒ | j ƒ  t t d ƒ �  } |  j | |  j |  j ƒ Wd  QXd  S(   NRL   (	   RK   R   RP   R9   RQ   RN   R'   R   RO   (   R   R$   RJ   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt   test_unseekable_read�   s    
c         C   sw   t  t d ƒ �I } |  j | ƒ } | j |  j ƒ | j |  j ƒ | j ƒ  d  |  _	 Wd  QX|  j
 t |  j |  j ƒ d  S(   NRC   (   R   R   RK   RP   R9   RQ   RN   R'   R#   R%   RO   (   R   RJ   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/audiotests.pyt   test_unseekable_write™   s    
c      	   C   sä   t  t d ƒ �� } | j d ƒ |  j | ƒ } | j |  j d ƒ y | j |  j ƒ Wn t k
 ri n Xy | j	 ƒ  Wn t k
 r‹ n XWd  QXt
 t d ƒ �= } |  j | j d ƒ d ƒ |  j | |  j d |  j ƒ Wd  QXd  S(   NRC   RT   i   RL   i   (   R   R   RU   RK   RP   R9   RQ   RN   t   IOErrorR'   RE   R)   RV   RO   (   R   RJ   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/audiotests.pyt!   test_unseekable_incompleted_write£   s    
c      
   C   sù   t  t d ƒ �� } | j d ƒ |  j | ƒ } | j |  j d ƒ y | j |  j ƒ Wn t k
 ri n Xy | j	 ƒ  Wn t k
 r‹ n XWd  QXt
 t d ƒ �R } |  j | j d ƒ d ƒ |  j |  j } |  j | |  j d |  j |  ƒ Wd  QXd  S(   NRC   RT   i   RL   i   (   R   R   RU   RK   RP   R9   RQ   RN   R]   R'   RE   R)   RV   R6   R7   RO   (   R   RJ   R$   RX   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt    test_unseekable_overflowed_writeµ   s     
(   R   R   RK   RO   RR   RS   RW   RY   RZ   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/audiotests.pyRB   E   s   										
	t   AudioTestsWithSourceFilec           B   sD   e  Z e d  „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   t  |  j d d ƒ|  _ d  S(   Nt   subdirt	   audiodata(   R    t   sndfilenamet   sndfilepath(   t   cls(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt
   setUpClassË   s    c         C   sQ   |  j  j |  j ƒ } |  _ |  j | |  j |  j |  j |  j |  j	 |  j
 ƒ d  S(   N(   RD   RE   Rd   R$   R?   R6   R7   R8   t   sndfilenframesR:   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/audiotests.pyt   test_read_paramsÏ   s    c      
   C   sò   t  |  j d ƒ �P } |  j j  | ƒ } |  _ |  j | j ƒ | j ƒ  |  j | j |  j ƒ Wd  QXt  t	 d ƒ �y } |  j j  | d ƒ } |  _
 |  j | j ƒ |  j |  j j ƒ � | j ƒ  Wd  QX|  j | j |  j ƒ | j ƒ  Wd  QXd  S(   NRL   RC   (   RE   Rd   RD   R$   t   assertFalset   closedR'   R)   RA   R   R%   t   assertRaisest   Error(   R   RJ   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/audiotests.pyt
   test_closeÕ   s    
c         C   s½  |  j  |  j } |  j d |  } |  j d | d | !} |  j j |  j ƒ } |  _ |  j | j d ƒ d ƒ |  j | j	 ƒ  d ƒ |  j | j d ƒ | ƒ | j
 ƒ  | j	 ƒ  } |  j | d ƒ |  j | j d ƒ | ƒ | j	 ƒ  } |  j | d ƒ |  j | j d ƒ | ƒ | j | ƒ |  j | j d ƒ | ƒ | j | ƒ |  j | j d ƒ | ƒ |  j |  j j ƒ � | j d ƒ Wd  QX|  j |  j j ƒ � | j | j ƒ  d ƒ Wd  QXd  S(   Ni   i   i    R   iÿÿÿÿi   (   R6   R7   RN   RD   RE   Rd   R$   R)   RM   R   t   rewindt   setposRk   Rl   R-   (   R   RX   t   chunk1t   chunk2R$   t   pos0t   pos2(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt	   test_readã   s,    
c         C   s  |  j  j |  j ƒ } |  _ |  j  j t d ƒ } |  _ | j | j ƒ  ƒ d } | j ƒ  } x: | d k r™ | d 7} | j	 | j
 | ƒ ƒ | | 8} q` W| j ƒ  |  j  j t d ƒ } |  _ | j ƒ  |  j | j ƒ  | j ƒ  ƒ |  j | j
 | j ƒ  ƒ | j
 | j ƒ  ƒ ƒ d  S(   NRC   i    i   RL   (   RD   RE   Rd   R$   R   R%   t	   setparamsR0   R-   RQ   RM   R'   Rn   R)   (   R   R$   R%   R    t   n(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyt	   test_copyû   s    


c      
   C   s2  t  t d ƒ �B } | j d ƒ t  |  j d ƒ � } | j | j ƒ  ƒ Wd  QXWd  QXt  t d ƒ �Ê } |  j | j d ƒ d ƒ |  j j  | d ƒ } z‡ |  j | j ƒ  |  j ƒ |  j | j	 ƒ  |  j
 ƒ |  j | j ƒ  |  j ƒ |  j | j ƒ  |  j ƒ |  j | j |  j ƒ |  j ƒ Wd  | j ƒ  XWd  QXd  S(   NRC   RT   RL   i   (   RE   R   RU   Rd   RV   R)   RD   R*   R6   R+   R7   R,   R8   R-   Rg   RM   R9   RN   R'   (   R   RJ   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/audiotests.pyt   test_read_not_from_start  s    #(	   R   R   t   classmethodRf   Rh   Rm   Rt   Rw   Rx   (    (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/audiotests.pyR`   É   s   				(    (   t   test.test_supportR    R   R   t   unittestR   R   R2   t   sysR   t   fileR   R   R   R   R!   R"   RB   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/audiotests.pyt   <module>   s   				„