HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/test/__pycache__/audiotests.cpython-36.opt-2.pyc
3


 \g0�@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	�'/usr/lib64/python3.6/test/audiotests.py�tellszUnseekableIO.tellcOs
tj�dS)N)rr)r�args�kwargsr	r	r
�seekszUnseekableIO.seekN)�__name__�
__module__�__qualname__rrr	r	r	r
rsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
AudioTestsFcCsd|_|_dS)N)�f�fout)rr	r	r
�setUpszAudioTests.setUpcCs4|jdk	r|jj�|jdk	r(|jj�tt�dS)N)r�closerrr)rr	r	r
�tearDowns




zAudioTests.tearDowncCs|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j�}|j|||||||f�|j|j|�|j|j	|�|j|j
|�|j|j|�|j|j|�|j|j
|�x4ttjd�D]"}	tj||	�}
|jtj|
�|�q�WdS)N�)�assertEqual�getnchannels�getsampwidth�getframerate�
getnframesZgetcomptypeZgetcompname�	getparams�	nchannels�	sampwidth�	framerate�nframes�comptype�compname�range�pickleZHIGHEST_PROTOCOL�dumps�loads)rrrr 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|jj|d�}|_|j|j�|j|j�|j|j�|j	|j
|j�|S)N�wb)�module�openr�setnchannelsr�setsampwidthr �setframerater!�setcomptyper#r$)r�testfilerr	r	r
�create_file6szAudioWriteTests.create_filec
Csv|jj|d��^}|j|j�|j�|j|j�|j�|j|j�|j�|j|j	�|�|j|j
|�|�WdQRXdS)N�rb)r0r1rrrrr rr!r�
readframes)rr6r"�framesrr	r	r
�
check_file>szAudioWriteTests.check_filecCsP|jt�}|j|j�|j|j�|j||j|j|j	|j|j
|j�|j�dS)N)
r7r�
setnframesr"�writeframesr:r,rr r!r#r$r)rrr	r	r
�test_write_paramsFs
z!AudioWriteTests.test_write_paramsc%Cs�|j|jj�� |jjtd��WdQRXWdQRX|j|jj��4ttd��}|jj|��WdQRXWdQRXWdQRXdS)Nr/)�assertRaisesr0�Errorr1r)rr6r	r	r
�&test_write_context_manager_calls_closeNsz6AudioWriteTests.test_write_context_manager_calls_closecCsttd��b}|jj|��:}|j|j�|j|j�|j|j�|j	|j
|j�WdQRX|j|j
|j�WdQRXttd���}|jj|��N}|j|j�j
�|j�}|j|j|j�|j|j|j�|j|j|j�WdQRX|js�|j|j��|j|j
|j�WdQRXdS)Nr/r8)r1rr0r2rr3r r4r!r5r#r$r�closedr-�assertFalse�getfpr�assertIsNone)rr6rr)r	r	r
�#test_context_manager_with_open_fileYs"z3AudioWriteTests.test_context_manager_with_open_filecCs�|jjtd��:}|j|j�|j|j�|j|j�|j	|j
|j�WdQRX|jjt��N}|j|j
�j�|j�}|j|j|j�|j|j|j�|j|j|j�WdQRX|js�|j|j
��dS)Nr/)r0r1rr2rr3r r4r!r5r#r$rCrDrBrrr-rE)rrr)r	r	r
�"test_context_manager_with_filenamelsz2AudioWriteTests.test_context_manager_with_filenamecCs@|jt�}|j|j�|j|j�|j�|jt|j|j�dS)N)r7rr<r"r=r:rr;)rrr	r	r
�
test_write}s

zAudioWriteTests.test_writecCsD|jt�}|j|j�|jt|j��|j�|jt|j|j�dS)N)	r7rr<r"r=�	bytearrayr:rr;)rrr	r	r
�test_write_bytearray�s

z$AudioWriteTests.test_write_bytearraycCsH|jt�}|j|j�|jtjd|j��|j�|jt|j|j�dS)N�h)	r7rr<r"r=�arrayr:rr;)rrr	r	r
�test_write_array�s

z AudioWriteTests.test_write_arraycCsD|jt�}|j|j�|jt|j��|j�|jt|j|j�dS)N)	r7rr<r"r=�
memoryviewr:rr;)rrr	r	r
�test_write_memoryview�s

z%AudioWriteTests.test_write_memoryviewcCs�ttd��>}|jd�|j|�}|j|jd�|j|j�|j�WdQRXttd��*}|j	|j
d�d�|j||j|j�WdQRXdS)Nr/s
ababagalamagarr8�
)r1r�writer7r<r"r=r:rr�readr;)rr6rr	r	r
�test_incompleted_write�s

z&AudioWriteTests.test_incompleted_writecCs�ttd��f}|jd�|j|�}|j|j�|j|j}|j|j	d|��|j|j	|d��|j
�WdQRXttd��*}|j|jd�d�|j
||j|j	�WdQRXdS)Nr/s
ababagalamagar8rP)r1rrQr7r<r"rr r=r:rrrRr;)rr6r�	framesizer	r	r
�test_multiple_writes�s

z$AudioWriteTests.test_multiple_writescCs�ttd��>}|jd�|j|�}|j|jd�|j|j�|j�WdQRXttd��*}|j	|j
d�d�|j||j|j�WdQRXdS)Nr/s
ababagalamagarr8rP)r1rrQr7r<r"r=r:rrrRr;)rr6rr	r	r
�test_overflowed_write�s

z%AudioWriteTests.test_overflowed_writecCsZ|jt��}|j|j�|j|j�WdQRXttd��}|j||j|j�WdQRXdS)Nr8)r7rr<r"r=r:rr;)rrr6r	r	r
�test_unseekable_read�s
z$AudioWriteTests.test_unseekable_readcCsZttd��4}|j|��}|j|j�|j|j�WdQRXWdQRX|jt|j|j�dS)Nr/)rrr7r<r"r=r:r;)rr6rr	r	r
�test_unseekable_write�s
 z%AudioWriteTests.test_unseekable_writec"Cs�ttd��r}|jd�|j|�}|j|jd�y|j|j�Wntk
rTYnXy|j	�Wntk
rvYnXWdQRXt
td��.}|j|jd�d�|j
||jd|j�WdQRXdS)Nr/s
ababagalamagarr8rP)rrrQr7r<r"r=r:�OSErrorrr1rrRr;)rr6rr	r	r
�!test_unseekable_incompleted_write�s

z1AudioWriteTests.test_unseekable_incompleted_writec$Cs�ttd��r}|jd�|j|�}|j|jd�y|j|j�Wntk
rTYnXy|j	�Wntk
rvYnXWdQRXt
td��D}|j|jd�d�|j
|j}|j||jd|jd|��WdQRXdS)Nr/s
ababagalamagarr8rP)rrrQr7r<r"r=r:rYrr1rrRrr r;)rr6rrTr	r	r
� test_unseekable_overflowed_write�s 

z0AudioWriteTests.test_unseekable_overflowed_writeN)rrrr7r;r>rArFrGrHrJrMrOrSrUrVrWrXrZr[r	r	r	r
r.4s"r.c@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.setUpClasscCs:|jj|j�}|_|j||j|j|j|j|j	|j
�dS)N)r0r1r]rr,rr r!�sndfilenframesr#r$)rrr	r	r
�test_read_params�sz)AudioTestsWithSourceFile.test_read_paramscCs�t|jd��<}|jj|�}|_|j|j�|j�|j|j|j�WdQRXtt	d��`}|jj|d�}|_
|j|j�|j|jj��|j�WdQRX|j|j|j�|j�WdQRXdS)Nr8r/)
r1r]r0rrCrBrrr-rrr?r@)rr6rrr	r	r
�
test_closesz#AudioTestsWithSourceFile.test_closecCs\|j|j}|jdd|�}|jd|d|�}|jj|j�}|_|j|jd�d�|j|j	�d�|j|jd�|�|j
�|j	�}|j|d�|j|jd�|�|j	�}|j|d�|j|jd�|�|j|�|j|jd�|�|j|�|j|jd�|�|j|jj
��|jd�WdQRX|j|jj
��|j|j�d�WdQRXdS)N��r�r���)rr r:r0r1r]rrr9r�rewindZsetposr?r@r)rrTZchunk1Zchunk2rZpos0Zpos2r	r	r
�	test_reads,

z"AudioTestsWithSourceFile.test_readcCs�|jj|j�}|_|jjtd�}|_|j|j��d}|j�}x,|dkrn|d7}|j	|j
|��||8}qDW|j�|jjtd�}|_|j�|j
|j�|j��|j
|j
|j��|j
|j���dS)Nr/rrr8)r0r1r]rrrZ	setparamsrrr=r9rrgr)rrr�i�nr	r	r
�	test_copy+s
z"AudioTestsWithSourceFile.test_copycCs�ttd��6}|jd�t|jd��}|j|j��WdQRXWdQRXttd���}|j|jd�d�|jj|d��d}|j|j�|j�|j|j	�|j
�|j|j�|j�|j|j
�|j�|j|j|j�|j�WdQRXWdQRXdS)Nr/s
ababagalamagar8rP)r1rrQr]rRrr0rrrr rr!rr`r9r"r:)rr6rr	r	r
�test_read_not_from_start<s
"z1AudioTestsWithSourceFile.test_read_not_from_startN)
rrr�classmethodr_rarbrhrkrlr	r	r	r
r\�sr\)Ztest.supportrrrrLrr&�FileIOrrr.r\r	r	r	r
�<module>s%F