HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_picklebuffer.cpython-310.opt-2.pyc
o

�i��@sl	ddlZddlmZddlZddlZddlmZGdd�de�ZGdd�dej	�Z
edkr4e��dSdS)	�N)�PickleBuffer)�
import_helperc@seZdZdS)�BN)�__name__�
__module__�__qualname__�rr�3/usr/local/lib/python3.10/test/test_picklebuffer.pyrsrc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�PickleBufferTestc	Cs�t|��o}t|��R}|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j	|j	�|�|�
�|�
��Wd�n1s^wYWd�dSWd�dS1svwYdS�N)�
memoryview�assertEqual�nbytes�readonly�itemsize�shape�strides�c_contiguous�f_contiguous�format�tobytes)�self�pb�equiv�mZexpectedrrr	�check_memoryviews

��"�z!PickleBufferTest.check_memoryviewcCs�|�t��t�Wd�n1swY|�t��td�Wd�n1s,wYtd�}|��|�t��
t|�Wd�dS1sNwYdS)NZfoo�foo)�assertRaises�	TypeErrorrr�release�
ValueError)rrrrr	�test_constructor_failure!s�
�
"�z)PickleBufferTest.test_constructor_failurecCs�td�}|�dt|��t|��}|�|j�Wd�n1s!wYttd��}|�dt|��t|��}|�|j�d|d<Wd�n1sMwY|�dt|��dS)Nr�0rs0oo)rr
�bytesr�
assertTruer�	bytearray�assertFalse)rrrrrr	�test_basics,s
�

�zPickleBufferTest.test_basicscCs`td�}|��|�t��}t|�Wd�n1swY|�dt|j��|��dS)Nrz3operation forbidden on released PickleBuffer object)rrrr rZassertIn�str�	exception�rrZraisesrrr	�test_release9s
��zPickleBufferTest.test_releasecCs<td�}t|�}||_t�|�}~~t��|�|��dS�Nr)rr�cycle�weakref�ref�gcZcollectZassertIsNone)r�brZwpbrrr	�
test_cycleCs
zPickleBufferTest.test_cyclecCs�t�d�j}|ttd��ddd�}|�|j�|�|j�t	|�}|�
||�|ddd�}|�|j�|�|j�t	|�}|�
||�|ttd��dddd	�}|�|j�|�|j�t	|�}|�
||�dS)
N�_testbuffer�����<i�rr�)r7r6)r6r4�rrr)r�
import_module�ndarray�list�ranger$rr&rrr)rr=�arrrrrr	�test_ndarray_2dLs z PickleBufferTest.test_ndarray_2dcCsNt|�}|���}|�|t�|�||�Wd�dS1s wYdSr)r�rawZassertIsInstancerr)r�objrrrrrr	�	check_rawcs

"�zPickleBufferTest.check_rawc	CsNdtd�fD]}|j|d��|�||�Wd�n1swYqdS)Nr)rC)r%ZsubTestrD)rrCrrr	�test_rawis���zPickleBufferTest.test_rawcCs�t�d�j}|ttd��ddd�}d}|�||�|ttd��ddd�}d	}|�||�|ttd��dd
dd�}d	}|�||�|dd
dd�}d}|�||�dS)Nr3r7)r7z<hr9s�)r:r7s)r:r6r;i�rr8s�)rr<r=r>r?rD)rr=r@rrrr	�test_raw_ndarrayns�z!PickleBufferTest.test_raw_ndarraycCsBt|�}|�td��
|��Wd�dS1swYdS)Nznon-contiguous)rZassertRaisesRegex�BufferErrorrB)rrCrrrr	�check_raw_non_contiguous�s
"�z)PickleBufferTest.check_raw_non_contiguouscCsdt�d�j}|ttd��ddd�ddd�}|�|�|ttd��ddd�ddd�}|�|�dS)	Nr3rF)rFr8r9r:r4r5)rr<r=r>r?rI)rr=r@rrr	�test_raw_non_contiguous�s
 
 z(PickleBufferTest.test_raw_non_contiguouscCsHtd�}|��|�t��
}|��Wd�dS1swYdSr,)rrrr rBr*rrr	�test_raw_released�s

"�z"PickleBufferTest.test_raw_releasedN)rrrrr!r'r+r2rArDrErGrIrJrKrrrr	r
s


		r
�__main__)
r0�picklerr.ZunittestZtest.supportrr#rZTestCaser
r�mainrrrr	�<module>s�