Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.219.152.33
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_marshal.cpython-310.pyc
o

ab�Q�@s�ddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
zddlZWney9dZYnwGdd�d�Z
Gdd�deje
�ZGdd	�d	eje
�ZGd
d�deje
�ZGdd
�d
ej�ZGdd�dej�ZGdd�deje
�ZGdd�deje
�ZGdd�dej�ZdZejdkr�dndZGdd�d�Ze�eejkd�Gdd�dej��Zdd �ZGd!d"�d"eje
�ZGd#d$�d$ej�ZGd%d&�d&eje
�Z ej!e�"ed'�Gd(d)�d)eje
���Z#e$d*kr�e�%�dSdS)+�)�support)�	os_helperNc@�eZdZdd�ZdS)�HelperMixinc	Gs�t�tj|g|�R��}|�||�zJttjd��}tj||g|�R�Wd�n1s.wYttjd��
}t�|�}Wd�n1sIwY|�||�Wt�	tj�dSt�	tj�w)N�wb�rb)
�marshal�loads�dumps�assertEqual�openr�TESTFN�dump�load�unlink)�self�sample�extra�new�f�r�:/usr/local/python-3.10/lib/python3.10/test/test_marshal.py�helpers��zHelperMixin.helperN)�__name__�
__module__�__qualname__rrrrrr�rc@�$eZdZdd�Zdd�Zdd�ZdS)�IntTestCasecCs<tjd}|r||fD]}|�|�q|d?}|sdSdS)N��)�sys�maxsizer)r�n�expectedrrr�	test_intss
�zIntTestCase.test_intscCs�d}|d}||||d?fD]'}|r8dtj|dddd�}t�|�}|�||�|dkr2d	}n|dL}|sqt�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_bytesrr	r)rZmaxint64Zminint64�base�s�gotrrr�
test_int64&s(

��
	


zIntTestCase.test_int64cCsdD]}|�|�qdS)N)TF�r)r�brrr�	test_bool=s�zIntTestCase.test_boolN)rrrr%r0r3rrrrrsrc@r)�
FloatTestCasecCs�d}tjd}||kr"||fD]	}|�t|��q|d}||ksd}t�|d�}t�|�}|�||�t�|d�}t�|�}|�||�tjd}||krp||fD]}t|�}|�|�|�|d�qT|d9}||ksOdSdS)Ng�}���:g�6�ҫ�sgS��:�^@grr g��Z1%)r!r"r�floatrr
r	r)rZsmallr#r$rr.r/rrr�test_floatsBs,
�



�zFloatTestCase.test_floatsN)rrrr6rrrrr4Arr4c@r)�StringTestCasecCs0dddddfD]
}|�t�t�|���qdS�N��
Andrè Previn�abc� �')rrr	r
�rr.rrr�test_unicode]s�zStringTestCase.test_unicodecC�$dddddfD]}|�|�qdSr8r1r>rrr�test_stringa��zStringTestCase.test_stringcCr@)N�sAndr� Previn�abc� r=r1r>rrr�
test_byteserBzStringTestCase.test_bytesN)rrrr?rArFrrrrr7\sr7c@r)�ExceptionTestCasecCs t�t�t��}|�t|�dS�N)rr	r
�
StopIterationr)rrrrr�test_exceptionsjsz!ExceptionTestCase.test_exceptionsN)rrrrJrrrrrGirrGc@s2eZdZdd�Zdd�Zdd�Zejdd��Zd	S)
�CodeTestCasecCs(tjj}t�t�|��}|�||�dSrH)rGrJ�__code__rr	r
r)r�corrrr�	test_codeoszCodeTestCase.test_codecCs&d}tjjf|}t�t�|��dS)Ni�)rGrJrLrr	r
)r�countZcodesrrr�test_many_codeobjectstsz"CodeTestCase.test_many_codeobjectscCsPtddd�}tddd�}t�t�||f��\}}|�|jd�|�|jd�dS)N�x�f1�exec�y�f2)�compilerr	r
r�co_filename)rZco1Zco2rrr�test_different_filenameszs
z%CodeTestCase.test_different_filenamescCsLd}t|dd�}t�t�|��}|jD]}t|tj�r#|�|j	|j	�qdS)Nzdef f(): pass
def g(): passZmyfilerS)
rVrr	r
�	co_consts�
isinstance�types�CodeTypeZassertIsrW)rr.rM�objrrr�test_same_filename_used�s
��z$CodeTestCase.test_same_filename_usedN)	rrrrNrPrXr�cpython_onlyr^rrrrrKnsrKc	@sDeZdZdddddgdddd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)�ContainerTestCasezfoo@bar.baz.spamgH�zns�@�r�.zyx.41)
rbrbrbrbrbrbrbrbrbrbFr:)ZastringZafloatZanintZ
ashortlongZalistZatupleZabooleanZaunicodecCs|�|j�dSrH)r�d�rrrr�	test_dict�szContainerTestCase.test_dictcC�|�t|j����dSrH)r�listrc�itemsrdrrr�	test_list��zContainerTestCase.test_listcCrfrH)r�tuplerc�keysrdrrr�
test_tuple�rjzContainerTestCase.test_tuplecCs&ttfD]}|�||j����qdSrH)�set�	frozensetrrcrl)r�constructorrrr�	test_sets�s�zContainerTestCase.test_setsN)rrrrcrerirmrqrrrrr`�s�
r`c@r)�BufferTestCasecC�6td�}|�|�t�t�|��}|�t|�t�dS�NrD)�	bytearrayrrr	r
r�type�bytes�rr2rrrr�test_bytearray��
zBufferTestCase.test_bytearraycCrsrt)�
memoryviewrrr	r
rrvrwrxrrr�test_memoryview�rzzBufferTestCase.test_memoryviewcCs,t�dd�}t�t�|��}|�|d�dS)N�BrD)�arrayrr	r
r)r�arrrr�
test_array�szBufferTestCase.test_arrayN)rrrryr|r�rrrrrr�srrc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�BugsTestCasecCst�dgd�dS)N���)rr
rdrrr�test_bug_5888452��zBugsTestCase.test_bug_5888452cCsF|�ttjd�|�ttjd�|�ttjt�dd�dd��dS)N�0�fr�Ar*)�assertRaises�	Exceptionrr	r
rdrrr�test_patch_873224�s&zBugsTestCase.test_patch_873224cCs8|�t�t�dd��d�|�t�t�dd��d�dS)N�rr )rrr	r
rdrrr�test_version_argument�sz"BugsTestCase.test_version_argumentc	Cs<td�D]}t|g�}zt�|�WqtyYqwdS)N�)�rangerwrr	r�)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{Nr�s>r)�N�checkrrr�	run_tests�s
z4BugsTestCase.test_loads_recursion.<locals>.run_tests�dcs��ttj|�dSrH�r��
ValueErrorrr	)r.rdrrr��sz0BugsTestCase.test_loads_recursion.<locals>.checkra)rr	)rr�r�rrdr�test_loads_recursion�sz!BugsTestCase.test_loads_recursioncCs�g}}tjdkrd}nd}t|d�D]}|�dg�|d}qt�|�}t�|�}|�t|�t|��|�t|d�t|d��|�t|d�t|d��|�dg�|�	t
tj|�dS)N�ntr�i�rrr*)�os�namer��appendrr
r	r�lenr�r�)r�headZlastZMAX_MARSHAL_STACK_DEPTHr��dataZnew_headrrr�test_recursion_limit�s



z!BugsTestCase.test_recursion_limitcCs>ttttttttfD]}td|fi�}|�	t
tj|��q
dS)N�subtyp)
r+r5�complexrkrg�dictrnrorvr�r�rr
)r�typr�rrr�test_exact_type_match�s�z"BugsTestCase.test_exact_type_matchcCstd�}d|}t�|�dS)Ng��.Ar;)r+rr
)r�sizeZ
testStringrrr�test_large_marshal
szBugsTestCase.test_large_marshalcC�d}|�ttj|�dS)Ns	lr�)rZinvalid_stringrrr�test_invalid_longs�zBugsTestCase.test_invalid_longsc
Cs ddddddddgff}d	D]}t|�}g}zpttjd
��!}|D]}t�||�|r/|�|�|�|���q Wd�n1sAwYttjd��+}t	|�D]\}}|�
|t�|��|re|�|�|�
|||���qQWd�n1szwYWt�
tj�qt�
tj�wdS)Nr r;sdef��?rrr2�c)rCs0123rr)r�rrr
rr�writer��tell�	enumeraterr�readr)rr�ZinterleavedZilenZ	positionsrrcr�rrr�test_multiple_dumps_and_loadss0
��
����z*BugsTestCase.test_multiple_dumps_and_loadscCr�)N�T)r��	TypeErrorrr	)rZunicode_stringrrr�!test_loads_reject_unicode_strings,r�z.BugsTestCase.test_loads_reject_unicode_stringsc	Cs:Gdd�dtj�}dD]}|�ttj|t�|���qdS)NcseZdZ�fdd�Z�ZS)z/BugsTestCase.test_bad_reader.<locals>.BadReadercs(t��|�}|dur|dkr|d7}|S)N�i@B)�super�readinto)r�bufr#��	__class__rrr�3sz8BugsTestCase.test_bad_reader.<locals>.BadReader.readinto)rrrr��
__classcell__rrr�r�	BadReader2sr�)r�y�?s
0123456789�
0123456789)�io�BytesIOr�r�rrr
)rr��valuerrr�test_bad_reader1s
��zBugsTestCase.test_bad_readercCs8t�d�}tt|��D]}|�ttj|d|��qdS)N)�helloZdollyNr)rr
r�r�r��EOFErrorr	)rr�r�rrr�test_eof<s
�zBugsTestCase.test_eofN)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s

r�ll��r'r�c@r)�
NullWritercCsdSrHrr>rrrr�EszNullWriter.writeN)rrrr�rrrrr�Drr�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��dSrH)r�r�rrr�)rr�rrr�check_unmarshallableJrjz(LargeValuesTestCase.check_unmarshallablerF)r�Zmemuse�dry_runcC�|�d|�dS)N�x�r��rr�rrrrFM�zLargeValuesTestCase.test_bytescCr�)NrQr�r�rrr�test_strQr�zLargeValuesTestCase.test_strr cCr�)NrHr�r�rrrrmUr�zLargeValuesTestCase.test_tuplecCs|�dg|�dSrHr�r�rrrriYr�zLargeValuesTestCase.test_list�cC�|�tt|���dSrH)r�rnr�r�rrr�test_set]�zLargeValuesTestCase.test_setcCr�rH)r�ror�r�rrr�test_frozensetcr�z"LargeValuesTestCase.test_frozensetcCs|�t|��dSrH)r�rur�rrrryir�z"LargeValuesTestCase.test_bytearrayN)rrrr�rZ
bigmemtest�
LARGE_SIZErFr��pointer_sizermrir!�	getsizeofr�r�ryrrrrr�Hs,



�
�
r�cCs�t|�|vrdS|�t|��t|ttttf�r&|D]}t||�qt
|�St|t�r>|�	�D]\}}t||�t||�q/t
|�S)z&Collect object ids seen in a structureN)�id�addrZrgrkrnro�CollectObjectIDsr�rhr�)Zidsr]�e�k�vrrrr�ms
�
r�c@s�eZdZddddeddh�fZddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) �InstancingTestCase�{獗n���?r;)r�r;FcCs�||f}tt�|�}tdtjd�D]}t�||�}tt�t�|��}|�||�q|s[t�|d�}	tt�t�|	��}
|�|
|�|sO|�t	|	�t	|��dS|�
t	|	�t	|��dSdS)N�r r)r�rnr�r�versionr
r	rZ
assertGreaterr�ZassertGreaterEqual)rZrsample�	recursive�simplerZn0r�Zs3Zn3�s2Zn2rrr�helper3~s�zInstancingTestCase.helper3cCs d}|�|�|j|dd�dS)Ni��T)r��rr�)rZintobjrrr�testInt�s
zInstancingTestCase.testIntcC�d}|�|�|�|�dS)Nr�r�)rZfloatobjrrr�	testFloat��
zInstancingTestCase.testFloatcCr�)NZabcdeabcdeabcder�)r�strobjrrr�testStr�r�zInstancingTestCase.testStrcCr�)Nsabcdeabcdeabcder�)rZbytesobjrrr�	testBytes�r�zInstancingTestCase.testBytescCs,|jD]}||g}|�|�|�|�qdSrH�rlrr�)rr]Zlistobjrrr�testList��


�zInstancingTestCase.testListcCs,|jD]}||f}|�|�|�|�qdSrHr�)rr]Ztupleobjrrr�	testTuple�r�zInstancingTestCase.testTuplecCs4|jD]}|df|dfh}|�|�|�|�qdS�Nr rr�)rr]Zsetobjrrr�testSet��


�zInstancingTestCase.testSetcCs8|jD]}t|df|dfh�}|�|�|�|�qdSr�)rlrorr�)rr]Zfrozensetobjrrr�
testFrozenSet�s


�z InstancingTestCase.testFrozenSetcCs4|jD]}d|d||di}|�|�|�|�qdS)Nr��goodbyer�)rr]Zdictobjrrr�testDict�r�zInstancingTestCase.testDictcCs`ttd��}|��}Wd�n1swYt�d�r$t|td�}|�|�|�|�dS�Nrz.pyrS)r�__file__r��endswithrVrr�)rr�coderrr�
testModule�s
�

zInstancingTestCase.testModulecCsNd}d|d||di}||d<|j|dd�||g}|�|�|j|dd�dS)Nr�r�r�rT)r�)r�r�)rr]rc�lrrr�
testRecursion�s
z InstancingTestCase.testRecursionN)FF)rrrrorlr�r�r�r�r�r�r�r�r�r�r�rrrrrr�{s
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�CompatibilityTestCasecCsbttd��}|��}Wd�n1swYt�d�r$t|td�}t�||�}t�|�dSr�)rr�r�r�rVrr
r	)rr�rr�r�rrr�_test�s
�
zCompatibilityTestCase._testcC�|�d�dS)Nr�rrdrrr�test0To3��zCompatibilityTestCase.test0To3cCr)Nr rrdrrr�test1To3�rzCompatibilityTestCase.test1To3cCr�Nrrrdrrr�test2To3�rzCompatibilityTestCase.test2To3cCr)Nr�rrdrrr�test3To3�rzCompatibilityTestCase.test3To3N)rrrrrrr	r
rrrrr�src@s*eZdZdZe�e�Zdd�Zdd�ZdS)�InterningTestCasezthis is an interned stringcCsXt�t�|j��}|�||j�|�t|�t|j��t�|�}|�t|�t|��dSrH)rr	r
r�rr�r!�intern�rr.r�rrr�
testIntern�s

zInterningTestCase.testInterncCsZt�t�|jd��}|�||j�|�t|�t|j��t�|�}|�t|�t|��dSr)	rr	r
r�rZassertNotEqualr�r!rr
rrr�testNoIntern�s

zInterningTestCase.testNoInternN)rrrr�r!rrrrrrrr�s

rzrequires _testcapic@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
CAPI_TestCasec	Cstttjd�D]0}t�dtj|�ttjd��}|��}Wd�n1s&wYt�	tj�|�
|d�qdS)Nr �xV4rsxV4)r�rr��	_testcapiZpymarshal_write_long_to_filerr
rr�rr)rr�rr�rrr�test_write_long_to_files
��z%CAPI_TestCase.test_write_long_to_filec	Cs�dddddddf}ttjd�D]3}t�|tj|�ttjd	��}|��}Wd�n1s0wYt�	tj�|�
t�|�|�qdS)
N�€rDr��������F@�@ @z
long line r�r r)r�rr�rZpymarshal_write_object_to_filerr
rr�rrr	)rr]r�rr�rrr�test_write_object_to_files
��z'CAPI_TestCase.test_write_object_to_filecC��ttjd��
}|�d�Wd�n1swYt�tj�\}}t�tj�|�|d�|�|d�ttjd��
}|�d�Wd�n1sKwY|�t	��t�tj�Wd�n1sfwYt�tj�dS)Nrs4xxxxi4r�)
rrr
r�rZpymarshal_read_short_from_filerrr�r��rr�r�prrr�test_read_short_from_file����z'CAPI_TestCase.test_read_short_from_filecCr)NrsxV4xxxxrr�sV4)
rrr
r�rZpymarshal_read_long_from_filerrr�r�rrrr�test_read_long_from_file%rz&CAPI_TestCase.test_read_long_from_filec	Cs
d}ttjd�D]y}t�||�}ttjd��}|�|d�Wd�n1s)wYt�	tj�\}}t�
tj�|�||�ttjd��}|�|dd��Wd�n1s\wY|�t
��t�	tj�Wd�n1swwYt�
tj�q	dS�N)rrDr�rrr rsxxxx)r�rr�r
rrr
r�rZ$pymarshal_read_last_object_from_filerrr�r��rr]r�r�rrrrrr�test_read_last_object_from_file3s"����z-CAPI_TestCase.test_read_last_object_from_filec	Csd}ttjd�D]�}t�||�}ttjd��}|�|d�Wd�n1s)wYt�	tj�\}}t�
tj�|�||�|�|t|��ttjd��}|�|dd��Wd�n1sdwY|�
t��t�	tj�Wd�n1swYt�
tj�q	dSr )r�rr�r
rrr
r�rZpymarshal_read_object_from_filerrr�r�r�r!rrr�test_read_object_from_fileCs$����z(CAPI_TestCase.test_read_object_from_fileN)	rrrrrrrr"r#rrrrrs	r�__main__)&�testrZtest.supportrr~r�rr!Zunittestr�r[r�ImportErrorrZTestCaserr4r7rGrKr`rrr�r�r"r�r�ZskipIfr�r�r�rrr_Z
skipUnlessrr�mainrrrr�<module>sN�
$
$`
Q�
© 2025 GrazzMean