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: //proc/thread-self/root/usr/local/lib/python3.7/test/__pycache__/test_marshal.cpython-37.opt-1.pyc
B

��g}N�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
rhdZ	YnXGdd�d�ZGdd�deje�Z
Gdd�deje�ZGd	d
�d
eje�ZGdd�dej�ZGd
d�dej�ZGdd�deje�ZGdd�deje�ZGdd�dej�ZdZejdk�r&dndZGdd�d�Ze�eejkd�Gdd�dej��Zdd�ZGd d!�d!eje�ZGd"d#�d#ej�ZGd$d%�d%eje�Zeje� e	d&�Gd'd(�d(eje���Z!e"d)k�r�e�#�dS)*�)�supportNc@seZdZdd�ZdS)�HelperMixinc	Gs�t�tj|f|���}|�||�z\ttjd��}tj||f|��WdQRXttjd��}t�|�}WdQRX|�||�Wdt�	tj�XdS)N�wb�rb)
�marshal�loads�dumps�assertEqual�openr�TESTFN�dump�load�unlink)�self�sampleZextra�new�f�r�-/usr/local/lib/python3.7/test/test_marshal.py�helperszHelperMixin.helperN)�__name__�
__module__�__qualname__rrrrrrsrc@s$eZdZdd�Zdd�Zdd�ZdS)�IntTestCasecCs>tjd}x.|r8x||fD]}|�|�qW|d?}qWdS)N��)�sys�maxsizer)r�n�expectedrrr�	test_intss

zIntTestCase.test_intscCs�d}|d}xh||||d?fD]P}xJ|rrdtj|dddd�}t�|�}|�||�|dkrhd	}q*|dL}q*Wq$Wt�d
�}|�|d�t�d�}|�|d
�t�d�}|�|d�t�d�}|�|d�dS)Nl����r�I��littleT)�signed���rs	I�ܺ�vT2l�\u1�Q�s	I#Eg����l�����\u1�Q�s	I*;L]nlTv0ur{s	I���ij���l����	Tv0ur{)�int�to_bytesrrr	)rZmaxint64Zminint64�base�s�gotrrr�
test_int64%s$





zIntTestCase.test_int64cCsxdD]}|�|�qWdS)N)TF)r)r�brrr�	test_bool<s
zIntTestCase.test_boolN)rrrr r+r-rrrrrsrc@seZdZdd�ZdS)�
FloatTestCasecCs�d}tjd}x6||krDx ||fD]}|�t|��q$W|d}qWd}t�|d�}t�|�}|�||�t�|d�}t�|�}|�||�tjd}xF||kr�x0||fD]"}t|�}|�|�|�|d�q�W|d9}q�WdS)Ng�}���:g�6�ҫ�sgS��:�^@grrg��Z1%)rrr�floatrrrr	)rZsmallrrrr)r*rrr�test_floatsAs(






zFloatTestCase.test_floatsN)rrrr0rrrrr.@sr.c@s$eZdZdd�Zdd�Zdd�ZdS)�StringTestCasecCs4x.dddddgD]}|�t�t�|���qWdS)N�u
Andrè Previn�abc� i')rrrr)rr)rrr�test_unicode\szStringTestCase.test_unicodecCs(x"dddddgD]}|�|�qWdS)Nr2u
Andrè Previnr3r4i')r)rr)rrr�test_string`szStringTestCase.test_stringcCs(x"dddddgD]}|�|�qWdS)N�sAndr� Previnsabc� i')r)rr)rrr�
test_bytesdszStringTestCase.test_bytesN)rrrr5r6r9rrrrr1[sr1c@seZdZdd�ZdS)�ExceptionTestCasecCs t�t�t��}|�t|�dS)N)rrr�
StopIterationr	)rrrrr�test_exceptionsisz!ExceptionTestCase.test_exceptionsN)rrrr<rrrrr:hsr:c@s2eZdZdd�Zdd�Zdd�Zejdd��Zd	S)
�CodeTestCasecCs(tjj}t�t�|��}|�||�dS)N)r:r<�__code__rrrr	)r�corrrr�	test_codenszCodeTestCase.test_codecCs&d}tjjf|}t�t�|��dS)Ni�)r:r<r>rrr)r�countZcodesrrr�test_many_codeobjectsssz"CodeTestCase.test_many_codeobjectscCsPtddd�}tddd�}t�t�||f��\}}|�|jd�|�|jd�dS)N�x�f1�exec�y�f2)�compilerrrr	�co_filename)rZco1Zco2rrr�test_different_filenamesys
z%CodeTestCase.test_different_filenamescCsPd}t|dd�}t�t�|��}x*|jD] }t|tj�r(|�|j	|j	�q(WdS)Nzdef f(): pass
def g(): passZmyfilerE)
rHrrr�	co_consts�
isinstance�types�CodeType�assertIsrI)rr)r?�objrrr�test_same_filename_used�sz$CodeTestCase.test_same_filename_usedN)	rrrr@rBrJr�cpython_onlyrQrrrrr=msr=c	@sReZdZdddddgdddd	�Zd
d�Zdd
�Zdd�Zdd�Zej	dd��Z
dS)�ContainerTestCasezfoo@bar.baz.spamgH�zns�@irz.zyx.41)
�.zyx.41rTrTrTrTrTrTrTrTrTFu
Andrè Previn)ZastringZafloatZanintZ
ashortlongZalistZatupleZabooleanZaunicodecCs|�|j�dS)N)r�d)rrrr�	test_dict�szContainerTestCase.test_dictcCs|�t|j����dS)N)r�listrU�items)rrrr�	test_list�szContainerTestCase.test_listcCs|�t|j����dS)N)r�tuplerU�keys)rrrr�
test_tuple�szContainerTestCase.test_tuplecCs*x$ttfD]}|�||j����q
WdS)N)�set�	frozensetrrUr[)r�constructorrrr�	test_sets�szContainerTestCase.test_setscCs&t�}t�t�|��}|�||�dS)N)r^rrrrO)rrPZobj2rrr�test_empty_frozenset_singleton�sz0ContainerTestCase.test_empty_frozenset_singletonN)rrrrUrVrYr\r`rrRrarrrrrS�srSc@s$eZdZdd�Zdd�Zdd�ZdS)�BufferTestCasecCs6td�}|�|�t�t�|��}|�t|�t�dS)Nsabc)�	bytearrayrrrrr	�type�bytes)rr,rrrr�test_bytearray�s
zBufferTestCase.test_bytearraycCs6td�}|�|�t�t�|��}|�t|�t�dS)Nsabc)�
memoryviewrrrrr	rdre)rr,rrrr�test_memoryview�s
zBufferTestCase.test_memoryviewcCs,t�dd�}t�t�|��}|�|d�dS)N�Bsabc)�arrayrrrr	)r�arrrr�
test_array�szBufferTestCase.test_arrayN)rrrrfrhrlrrrrrb�srbc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�BugsTestCasecCst�dgd�dS)N�i�)rr)rrrr�test_bug_5888452�szBugsTestCase.test_bug_5888452cCsF|�ttjd�|�ttjd�|�ttjt�dd�dd��dS)N�0�fr�Ar%)�assertRaises�	Exceptionrrr)rrrr�test_patch_873224�szBugsTestCase.test_patch_873224cCs8|�t�t�dd��d�|�t�t�dd��d�dS)N�rr)r	rrr)rrrr�test_version_argument�sz"BugsTestCase.test_version_argumentc	CsDx>td�D]2}t|g�}yt�|�Wq
tk
r:Yq
Xq
WdS)N�)�rangererrrt)r�i�crrr�	test_fuzz�s
zBugsTestCase.test_fuzzcs.dd�}|dtj��fdd�}|d|�dS)NcSs\|d|d�|d|d�|d|d�|d|dd|�|d|d�dS)Ns)�Ns(s[s{Nrps>r)�N�checkrrr�	run_tests�s
z4BugsTestCase.test_loads_recursion.<locals>.run_tests�dcs��ttj|�dS)N)rs�
ValueErrorrr)r))rrrr�sz0BugsTestCase.test_loads_recursion.<locals>.checki)rr)rr�rr)rr�test_loads_recursion�sz!BugsTestCase.test_loads_recursioncCs�g}}tjdkrd}nd}x(t|d�D]}|�dg�|d}q*Wt�|�}t�|�}|�t|�t|��|�t|d�t|d��|�t|d�t|d��|�dg�|�	t
tj|�dS)N�nti�i�rrr%)�os�namery�appendrrrr	�lenrsr�)r�headZlastZMAX_MARSHAL_STACK_DEPTHrz�dataZnew_headrrr�test_recursion_limit�s


z!BugsTestCase.test_recursion_limitcCsBx<ttttttttfD]$}td|fi�}|�	t
tj|��qWdS)N�subtyp)
r&r/�complexrZrW�dictr]r^rdrsr�rr)r�typr�rrr�test_exact_type_matchsz"BugsTestCase.test_exact_type_matchcCstd�}d|}t�|�dS)Ng��.Ar3)r&rr)r�sizeZ
testStringrrr�test_large_marshalszBugsTestCase.test_large_marshalcCsd}|�ttj|�dS)Ns	l)rsr�rr)rZinvalid_stringrrr�test_invalid_longsszBugsTestCase.test_invalid_longsc
Cs�ddddddddgff}x�d	D]�}t|�}g}z�ttjd
��<}x4|D],}t�||�|rb|�|�|�|���qDWWdQRXttjd��P}xHt	|�D]<\}}|�
|t�|��|r�|�|�|�
|||���q�WWdQRXWdt�
tj�XqWdS)Nrr3sdefg�?rrkr,�c)r7s0123rr)r�r
rrrr�writer��tell�	enumerater	r
�readr)rr�ZinterleavedZilenZ	positionsrrUrzrrr�test_multiple_dumps_and_loadss$



&z*BugsTestCase.test_multiple_dumps_and_loadscCsd}|�ttj|�dS)N�T)rs�	TypeErrorrr)rZunicode_stringrrr�!test_loads_reject_unicode_strings2sz.BugsTestCase.test_loads_reject_unicode_stringsc	Cs>Gdd�dtj�}x&dD]}|�ttj|t�|���qWdS)NcseZdZ�fdd�Z�ZS)z/BugsTestCase.test_bad_reader.<locals>.BadReadercs(t��|�}|dk	r$|dkr$|d7}|S)N�i@B)�super�readinto)r�bufr)�	__class__rrr�9sz8BugsTestCase.test_bad_reader.<locals>.BadReader.readinto)rrrr��
__classcell__rr)r�r�	BadReader8sr�)g�?y�?s
0123456789�
0123456789)�io�BytesIOrsr�rr
r)rr��valuerrr�test_bad_reader7s

zBugsTestCase.test_bad_readercCs<t�d�}x,tt|��D]}|�ttj|d|��qWdS)N)�helloZdollyNr)rrryr�rs�EOFErrorr)rr�rzrrr�test_eofBs
zBugsTestCase.test_eofN)rrrrorurwr|r�r�r�r�r�r�r�r�r�rrrrrm�s

rmll��r"r�c@seZdZdd�ZdS)�
NullWritercCsdS)Nr)rr)rrrr�KszNullWriter.writeN)rrrr�rrrrr�Jsr�z!test cannot run on 32-bit systemsc@s�eZdZdd�Zejeddd�dd��Zejeddd�dd	��Zejee	d
dd�dd��Z
ejee	d
dd�d
d��Zejee	de�
ed
�dd�dd��Zejee	de�
ed
�dd�dd��Zejeddd�dd��ZdS)�LargeValuesTestCasecCs|�ttj|t��dS)N)rsr�rrr�)rr�rrr�check_unmarshallablePsz(LargeValuesTestCase.check_unmarshallablerF)r�ZmemuseZdry_runcCs|�d|�dS)N�x)r�)rr�rrrr9SszLargeValuesTestCase.test_bytescCs|�d|�dS)NrC)r�)rr�rrr�test_strWszLargeValuesTestCase.test_strrcCs|�d|�dS)N)N)r�)rr�rrrr\[szLargeValuesTestCase.test_tuplecCs|�dg|�dS)N)r�)rr�rrrrY_szLargeValuesTestCase.test_list�cCs|�tt|���dS)N)r�r]ry)rr�rrr�test_setcszLargeValuesTestCase.test_setcCs|�tt|���dS)N)r�r^ry)rr�rrr�test_frozensetisz"LargeValuesTestCase.test_frozensetcCs|�t|��dS)N)r�rc)rr�rrrrfosz"LargeValuesTestCase.test_bytearrayN)rrrr�rZ
bigmemtest�
LARGE_SIZEr9r��pointer_sizer\rYr�	getsizeofr�r�rfrrrrr�Nsr�cCs�t|�|krdS|�t|��t|ttttf�rJxL|D]}t||�q6Wn4t|t�r~x(|�	�D]\}}t||�t||�q^Wt
|�S)z&Collect object ids seen in a structureN)�id�addrLrWrZr]r^�CollectObjectIDsr�rXr�)ZidsrP�e�k�vrrrr�ss


r�c@sbeZdZdZdZdZdedeediZddd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�InstancingTestCasei��g��n���?Zabcdeabcdeabcder�ZgoodbyeFc
Cs�||f}tt�|�}t�|d�}tt�t�|��}|�||�|s�t�|d�}tt�t�|��}	|�|	|�|s�|�t|�t|��n|�t|�t|��dS)N�r)	r�r]rrrr	Z
assertGreaterr�ZassertGreaterEqual)
rZrsample�	recursive�simplerZn0Zs3Zn3�s2Zn2rrr�helper3�szInstancingTestCase.helper3cCs |�|j�|j|jdd�dS)NT)r�)r�intobjr�)rrrr�testInt�szInstancingTestCase.testIntcCs|�|j�|�|j�dS)N)r�floatobjr�)rrrr�	testFloat�szInstancingTestCase.testFloatcCs|�|j�|�|j�dS)N)r�strobjr�)rrrr�testStr�szInstancingTestCase.testStrcCs|�|j�|�|j�dS)N)r�dictobjr�)rrrr�testDict�szInstancingTestCase.testDictc	CsLttd��}|��}WdQRXt�d�r4t|td�}|�|�|�|�dS)Nrz.pyrE)r
�__file__r��endswithrHrr�)rr�coderrr�
testModule�s

zInstancingTestCase.testModulecCsDt|j�}||d<|j|dd�|jg}|�|�|j|dd�dS)NrT)r�)r�r�r�r�)rrU�lrrr�
testRecursion�s

z InstancingTestCase.testRecursionN)FF)rrrr�r�r�r�r�r�r�r�r�r�r�rrrrr��s
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�CompatibilityTestCasec	CsNttd��}|��}WdQRXt�d�r4t|td�}t�||�}t�|�dS)Nrz.pyrE)r
r�r�r�rHrrr)r�versionrr�r�rrr�_test�s
zCompatibilityTestCase._testcCs|�d�dS)Nr)r�)rrrr�test0To3�szCompatibilityTestCase.test0To3cCs|�d�dS)Nr)r�)rrrr�test1To3�szCompatibilityTestCase.test1To3cCs|�d�dS)Nr)r�)rrrr�test2To3�szCompatibilityTestCase.test2To3cCs|�d�dS)Nr�)r�)rrrr�test3To3�szCompatibilityTestCase.test3To3N)rrrr�r�r�r�r�rrrrr��s
r�c@s*eZdZdZe�e�Zdd�Zdd�ZdS)�InterningTestCasezthis is an interned stringcCsXt�t�|j��}|�||j�|�t|�t|j��t�|�}|�t|�t|��dS)N)rrrr�r	r�r�intern)rr)r�rrr�
testIntern�s

zInterningTestCase.testInterncCsZt�t�|jd��}|�||j�|�t|�t|j��t�|�}|�t|�t|��dS)Nr)	rrrr�r	ZassertNotEqualr�rr�)rr)r�rrr�testNoIntern�s

zInterningTestCase.testNoInternN)rrrr�rr�r�r�rrrrr��s
r�zrequires _testcapic@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
CAPI_TestCasec
Csdx^ttjd�D]L}t�dtj|�ttjd��}|��}WdQRXt�	tj�|�
|d�qWdS)NrixV4rsxV4)ryrr��	_testcapiZpymarshal_write_long_to_filerrr
r�rr	)rr�rr�rrr�test_write_long_to_file�sz%CAPI_TestCase.test_write_long_to_filec
Cs~dddddddf}xdttjd�D]R}t�|tj|�ttjd	��}|��}WdQRXt�	tj�|�
t�|�|�q$WdS)
Nu€sabc�{g������F@y@ @z
long line i�rr)ryrr�r�Zpymarshal_write_object_to_filerrr
r�rr	r)rrPr�rr�rrr�test_write_object_to_file�sz'CAPI_TestCase.test_write_object_to_filec	Cs�ttjd��}|�d�WdQRXt�tj�\}}t�tj�|�|d�|�|d�ttjd��}|�d�WdQRX|�t	��t�tj�WdQRXt�tj�dS)Nrs4xxxxi4r�)
r
rrr�r�Zpymarshal_read_short_from_filerr	rsr�)rr�r�prrr�test_read_short_from_file�sz'CAPI_TestCase.test_read_short_from_filec	Cs�ttjd��}|�d�WdQRXt�tj�\}}t�tj�|�|d�|�|d�ttjd��}|�d�WdQRX|�t	��t�tj�WdQRXt�tj�dS)NrsxV4xxxxixV4r�sV4)
r
rrr�r�Zpymarshal_read_long_from_filerr	rsr�)rrr�r�rrr�test_read_long_from_file
sz&CAPI_TestCase.test_read_long_from_filec
Cs�d}x�ttjd�D]�}t�||�}ttjd��}|�|d�WdQRXt�	tj�\}}t�
tj�|�||�ttjd��}|�|dd��WdQRX|�t
��t�	tj�WdQRXt�
tj�qWdS)N)u€sabcr�g������F@y@ @rrsxxxx)ryrr�rr
rrr�r�Z$pymarshal_read_last_object_from_filerr	rsr�)rrPr�r�rr�r�rrr�test_read_last_object_from_filesz-CAPI_TestCase.test_read_last_object_from_filec
Cs�d}x�ttjd�D]�}t�||�}ttjd��}|�|d�WdQRXt�	tj�\}}t�
tj�|�||�|�|t|��ttjd��}|�|dd��WdQRX|�
t��t�	tj�WdQRXt�
tj�qWdS)N)u€sabcr�g������F@y@ @rrsxxxx)ryrr�rr
rrr�r�Zpymarshal_read_object_from_filerr	r�rsr�)rrPr�r�rr�r�rrr�test_read_object_from_file(sz(CAPI_TestCase.test_read_object_from_fileN)	rrrr�r�r�r�r�r�rrrrr��s	r��__main__)$Ztestrrjr�rrZunittestr�rMr��ImportErrorrZTestCaserr.r1r:r=rSrbrmr�rr�r�ZskipIfr�r�r�r�r�rRZ
skipUnlessr�r�mainrrrr�<module>sF

$
 
$?Q