Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/audiotests.cpython-39.opt-1.pyc

a

XC?hg0�@spddlmZmZmZddlZddlZddlZGdd�dej�ZGdd�d�Z	Gdd�de	�Z
Gd	d
�d
e	�ZdS)�)�findfile�TESTFN�unlinkNc@seZdZdd�Zdd�ZdS)�UnseekableIOcCs
tj�dS�N��io�UnsupportedOperation��self�r�4/opt/alt/python39/lib64/python3.9/test/audiotests.py�tellszUnseekableIO.tellcOs
tj�dSrr)r�args�kwargsrrr
�seekszUnseekableIO.seekN)�__name__�
__module__�__qualname__rrrrrr
rsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
AudioTestsFcCsd|_|_dSr)�f�foutr
rrr
�setUpszAudioTests.setUpcCs4|jdur|j��|jdur(|j��tt�dSr)r�closerrrr
rrr
�tearDowns




zAudioTests.tearDownc	Cs
|�|��|�|�|��|�|�|��|�|�|��|�|�|��|�|�|��|�|��}|�|||||||f�|�|j|�|�|j	|�|�|j
|�|�|j|�|�|j|�|�|j
|�ttjd�D]"}	t�||	�}
|�t�|
�|�q�dS)N�)�assertEqual�getnchannels�getsampwidth�getframerate�
getnframesZgetcomptypeZgetcompname�	getparams�	nchannels�	sampwidth�	framerate�nframes�comptype�compname�range�pickleZHIGHEST_PROTOCOL�dumps�loads)rrr"r#r$r%r&r'�params�proto�dumprrr
�check_paramss&�zAudioTests.check_paramsN)rrr�close_fdrrr/rrrr
rsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�AudioWriteTestscCsL|j�|d�}|_|�|j�|�|j�|�|j�|�	|j
|j�|S�N�wb)�module�openr�setnchannelsr"�setsampwidthr#�setframerater$�setcomptyper&r'�r�testfilerrrr
�create_file6szAudioWriteTests.create_filecCs�|j�|d��h}|�|��|j�|�|��|j�|�|��|j�|�|�	�|�|�|�
|�|�Wd�n1s|0YdS�N�rb)r4r5rrr"rr#rr$r �
readframes)rr;r%�framesrrrr
�
check_file>szAudioWriteTests.check_filec	CsP|�t�}|�|j�|�|j�|�||j|j|j	|j|j
|j�|��dSr)
r<r�
setnframesr%�writeframesr@r/r"r#r$r&r'r�rrrrr
�test_write_paramsFs
�z!AudioWriteTests.test_write_paramsc
Cs�|�|jj��>|j�td��Wd�n1s40YWd�n1sR0Y|�|jj��fttd��<}|j�|��Wd�n1s�0YWd�n1s�0YWd�n1s�0YdSr2)�assertRaisesr4�Errorr5r)rr;rrr
�&test_write_context_manager_calls_closeNs<z6AudioWriteTests.test_write_context_manager_calls_closec	Csfttd���}|j�|��D}|�|j�|�|j�|�|j�|�	|j
|j�Wd�n1sb0Y|�|j
|j�Wd�n1s�0Yttd���}|j�|��X}|�|��j
�|��}|�|j|j�|�|j|j�|�|j|j�Wd�n1�s0Y|j�s2|�|���|�|j
|j�Wd�n1�sX0YdS)Nr3r>)r5rr4r6r"r7r#r8r$r9r&r'r�closedr0�assertFalse�getfpr!�assertIsNone)rr;rr,rrr
�#test_context_manager_with_open_fileYs"..0z3AudioWriteTests.test_context_manager_with_open_filecCs�|j�td��D}|�|j�|�|j�|�|j�|�	|j
|j�Wd�n1sX0Y|j�t��X}|�|�
�j�|��}|�|j|j�|�|j|j�|�|j|j�Wd�n1s�0Y|js�|�|�
��dSr2)r4r5rr6r"r7r#r8r$r9r&r'rJrKrIr!rr0rL)rrr,rrr
�"test_context_manager_with_filenamels..z2AudioWriteTests.test_context_manager_with_filenamecCs@|�t�}|�|j�|�|j�|��|�t|j|j�dSr)r<rrBr%rCr@rrArDrrr
�
test_write}s

zAudioWriteTests.test_writecCsD|�t�}|�|j�|�t|j��|��|�t|j|j�dSr)	r<rrBr%rC�	bytearrayr@rrArDrrr
�test_write_bytearray�s

z$AudioWriteTests.test_write_bytearraycCsH|�t�}|�|j�|�t�d|j��|��|�t|j|j�dS)N�h)	r<rrBr%rC�arrayr@rrArDrrr
�test_write_array�s

z AudioWriteTests.test_write_arraycCsD|�t�}|�|j�|�t|j��|��|�t|j|j�dSr)	r<rrBr%rC�
memoryviewr@rrArDrrr
�test_write_memoryview�s

z%AudioWriteTests.test_write_memoryviewcCs�ttd��H}|�d�|�|�}|�|jd�|�|j�|��Wd�n1sX0Yttd��4}|�	|�
d�d�|�||j|j�Wd�n1s�0YdS�Nr3�
ababagalamagarr>�
�r5r�writer<rBr%rCr@rr�readrAr:rrr
�test_incompleted_write�s

&z&AudioWriteTests.test_incompleted_writecCs�ttd��p}|�d�|�|�}|�|j�|j|j}|�|j	d|��|�|j	|d��|�
�Wd�n1s�0Yttd��4}|�|�d�d�|�
||j|j	�Wd�n1s�0YdS�Nr3rXr>rY)r5rr[r<rBr%r"r#rCr@rrr\rA�rr;r�	framesizerrr
�test_multiple_writes�s

&z$AudioWriteTests.test_multiple_writescCs�ttd��H}|�d�|�|�}|�|jd�|�|j�|��Wd�n1sX0Yttd��4}|�	|�
d�d�|�||j|j�Wd�n1s�0YdSrWrZr:rrr
�test_overflowed_write�s

&z%AudioWriteTests.test_overflowed_writecCs�|�t��(}|�|j�|�|j�Wd�n1s80Yttd��"}|�||j|j�Wd�n1st0YdSr=)r<rrBr%rCr@rrA)rrr;rrr
�test_unseekable_read�s
*z$AudioWriteTests.test_unseekable_readc	Cs�ttd��R}|�|��(}|�|j�|�|j�Wd�n1sD0YWd�n1sb0Y|�t|j|j�dSr2)rrr<rBr%rCr@rAr:rrr
�test_unseekable_write�s
Hz%AudioWriteTests.test_unseekable_writec	Cs�ttd��x}|�d�|�|�}|�|jd�z|�|j�WntyRYn0z|�	�WntyrYn0Wd�n1s�0Yt
td��8}|�|�d�d�|�
||jd|j�Wd�n1s�0YdSrW)rrr[r<rBr%rCr@�OSErrorrr5rr\rAr:rrr
�!test_unseekable_incompleted_write�s

$z1AudioWriteTests.test_unseekable_incompleted_writec	Cs�ttd��x}|�d�|�|�}|�|jd�z|�|j�WntyRYn0z|�	�WntyrYn0Wd�n1s�0Yt
td��N}|�|�d�d�|j
|j}|�||jd|jd|��Wd�n1s�0YdSrW)rrr[r<rBr%rCr@rerr5rr\r"r#rAr_rrr
� test_unseekable_overflowed_write�s 

$z0AudioWriteTests.test_unseekable_overflowed_writeN)rrrr<rArErHrMrNrOrQrTrVr]rarbrcrdrfrgrrrr
r14s"r1c@s@eZdZedd��Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�AudioTestsWithSourceFilecCst|jdd�|_dS)NZ	audiodata)Zsubdir)rZsndfilename�sndfilepath)�clsrrr
�
setUpClass�sz#AudioTestsWithSourceFile.setUpClassc	Cs:|j�|j�}|_|�||j|j|j|j|j	|j
�dSr)r4r5rirr/r"r#r$�sndfilenframesr&r'rDrrr
�test_read_params�s�z)AudioTestsWithSourceFile.test_read_paramsc	Cs�t|jd��F}|j�|�}|_|�|j�|��|�|j|j�Wd�n1sX0Ytt	d��~}|j�|d�}|_
|�|j�|�|jj��|��Wd�n1s�0Y|�|j|j�|��Wd�n1s�0YdS)Nr>r3)
r5rir4rrJrIrrr0rrrFrG)rr;rrrrr
�
test_closes.&z#AudioTestsWithSourceFile.test_closecCs�|j|j}|jdd|�}|jd|d|�}|j�|j�}|_|�|�d�d�|�|�	�d�|�|�d�|�|�
�|�	�}|�|d�|�|�d�|�|�	�}|�|d�|�|�d�|�|�|�|�|�d�|�|�|�|�|�d�|�|�|jj
��|�d�Wd�n1�s80Y|�|jj
��"|�|��d�Wd�n1�sz0YdS)N��r����r)r"r#r@r4r5rirrr?r�rewindZsetposrFrGr )rr`Zchunk1Zchunk2rZpos0Zpos2rrr
�	test_reads,

*z"AudioTestsWithSourceFile.test_readcCs�|j�|j�}|_|j�td�}|_|�|���d}|��}|dkrl|d7}|�	|�
|��||8}qB|��|j�td�}|_|��|�
|��|���|�
|�
|���|�
|����dS)Nr3rrr>)r4r5rirrrZ	setparamsr!r rCr?rrsr)rrr�i�nrrr
�	test_copy+s 
�z"AudioTestsWithSourceFile.test_copyc	Cs>ttd��T}|�d�t|jd��}|�|���Wd�n1sF0YWd�n1sd0Yttd���}|�|�d�d�|j�|d��n}|�|��|j�|�|�	�|j
�|�|��|j�|�|�
�|j�|�|�|j�|j�Wd�n1�s0YWd�n1�s00YdSr^)r5rr[rir\rr4rr"rr#rr$r rlr?r%r@r:rrr
�test_read_not_from_start<s
Jz1AudioTestsWithSourceFile.test_read_not_from_startN)
rrr�classmethodrkrmrnrtrwrxrrrr
rh�s
rh)Ztest.supportrrrrSrr)�FileIOrrr1rhrrrr
�<module>s%F