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_set.cpython-310.opt-2.pyc
o

�i`�@s�ddlZddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
mZmZddl
Z
ddlZddlZddlZGdd�de�Zdd�ZGd	d
�d
�ZGdd�d�ZGd
d�de�ZGdd�d�ZGdd�deej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�deej�Z Gdd�de!�Z"Gdd �d e �Z#e�Z$Gd!d"�d"�Z%Gd#d$�d$e%ej�Z&Gd%d&�d&e%ej�Z'Gd'd(�d(e%ej�Z(Gd)d*�d*e%ej�Z)Gd+d,�d,e%ej�Z*Gd-d.�d.e%ej�Z+Gd/d0�d0e%ej�Z,d1d2�Z-d3d4�Z.Gd5d6�d6ej�Z/Gd7d8�d8ej�Z0Gd9d:�d:ej�Z1Gd;d<�d<ej�Z2Gd=d>�d>ej�Z3Gd?d@�d@�Z4GdAdB�dBe4ej�Z5GdCdD�dDe4ej�Z6GdEdF�dFe4ej�Z7GdGdH�dHe4ej�Z8GdIdJ�dJe4ej�Z9GdKdL�dL�Z:GdMdN�dNe:ej�Z;GdOdP�dPe:ej�Z<GdQdR�dRe:ej�Z=GdSdT�dTe:ej�Z>GdUdV�dVe:ej�Z?GdWdX�dXe:ej�Z@GdYdZ�dZ�ZAGd[d\�d\eAej�ZBGd]d^�d^eAej�ZCGd_d`�d`eAej�ZDGdadb�dbeAej�ZEGdcdd�ddeAej�ZFGdedf�dfej�ZGdgdh�ZHGdidj�dj�ZIGdkdl�dl�ZJGdmdn�dn�ZKGdodp�dp�ZLGdqdr�dr�ZMGdsdt�dt�ZNGdudv�dv�ZOddwlmPZPdxdy�ZQGdzd{�d{ej�ZRGd|d}�d}�ZSGd~d�d�ZTGd�d��d�ej�ZUGd�d��d��ZVGd�d��d�eV�ZWGd�d��d�eWej�ZXGd�d��d�eWej�ZYGd�d��d�eWej�ZZGd�d��d�eWej�Z[Gd�d��d�eV�Z\Gd�d��d�e\ej�Z]Gd�d��d�e\ej�Z^Gd�d��d�e\ej�Z_Gd�d��d�e\ej�Z`Gd�d��d�e\ej�ZaGd�d��d�e\ej�Zbd�d��Zcd�d��Zdd�d��Zed�d��ZfGd�d��d�ej�Zgehd�k�r�e�i�dSdS)��N)�support)�warnings_helper)�	randrange�shufflec@�eZdZdS)�PassThruN��__name__�
__module__�__qualname__�rr�*/usr/local/lib/python3.10/test/test_set.pyr�rcc��t��N)rrrrr
�check_pass_thru��rc@�eZdZdd�Zdd�ZdS)�BadCmpcC�dS�N�r��selfrrr
�__hash__�zBadCmp.__hash__cC�t�r)�RuntimeError�r�otherrrr
�__eq__rz
BadCmp.__eq__N�r	r
rrr rrrr
rsrc@seZdZ	dd�ZdS)�ReprWrappercCs
t|j�Sr)�repr�valuerrrr
�__repr__�
zReprWrapper.__repr__N)r	r
rr%rrrr
r"sr"c@�eZdZ	dd�Zdd�ZdS)�HashCountingIntcGs
d|_dS�Nr��
hash_count)r�argsrrr
�__init__#r&zHashCountingInt.__init__cCs|jd7_t�|�Sr)r+�intrrrrr
r%s
zHashCountingInt.__hash__N)r	r
rr-rrrrr
r(!�r(c@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#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7S)8�TestJointOpscCs2d|_}d|_d|_|�|�|_t�|�|_dS)NZ
simsalabimZ
madagascarZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)�word�	otherword�letters�thetype�s�dict�fromkeys�d)rr1rrr
�setUp,s

zTestJointOps.setUpcCs*|�t|jgd�|jtt�jdd�dS)N�r��a)�assertRaises�	TypeErrorr4�setr-rrrr
�test_new_or_init3�zTestJointOps.test_new_or_initcCsHt|j�}t|j�}|�||�|�t|jt��|�t|jgg�dSr)	�sortedr5r8�assertEqualr=rr4rr>)r�actual�expectedrrr
�test_uniquification7s


z TestJointOps.test_uniquificationcCs|�t|j�t|j��dSr)rC�lenr5r8rrrr
�test_len>szTestJointOps.test_lencCsb|jD]}|�||jv||jv�q|�t|jjgg�|�t|j�g�}|�	|�|j�|�dSr)
r3rCr5r8r=r>�__contains__r4�	frozenset�assertIn)r�cr5rrr
�
test_containsAs

zTestJointOps.test_containscCs�|j�|j�}|jD]}|�||v||jvp||jv�q
|�|j|�|j��|�t|�|j	�|�
t|jjt��|�
t
|jjgg�tttjtttfD]U}|�|�d��|d��td��|�|�d��|d��td��|�|�d��|d��td��|�|�d��|d��td	��|�|�d��|d�|d
��td��qN|��}|�|�tdg�|tdg��|�ddg��dS)
N�abcba�cdc�abcd�efgfe�abcefg�ccb�abc�ef�abcefZfgrr:)r5�unionr2r3rCr8r4r1�type�basetyper=rrr>r?rJr6r7�str�list�tuple)r�urL�C�xrrr
�
test_unionHs
"    (0zTestJointOps.test_unioncCsr|j�|j�}|�|jt|j�B|�|�|jt|j�B|�z|j|jBWn
ty1YdSw|�d�dS)Nz(s|t did not screen-out general iterables)r5rWr2rCr?rJr>�fail�r�irrr
�test_or[��zTestJointOps.test_orcCs�|j�|j�}|jD]}|�||v||jvo||jv�q
|�|j|�|j��|�t|�|j	�|�
t|jjt��t
ttjtttfD]U}|�|�d��|d��t
d��|�|�d��|d��t
d��|�|�d��|d��t
d��|�|�d��|d��t
d��|�|�d��|d	�|d
��t
d��qD|�d�}|��}|jt�kr�|�t|�t|��dS|�t|�t|��dS)NrNrO�ccrQ�rS�bcrUZcbcfZbag�b)r5�intersectionr2r3rCr8r4r1rXrYr=rrr?rJr6r7rZr[r\�id�assertNotEqual)rrcrLr^r5�zrrr
�test_intersectionfs"
"    (
zTestJointOps.test_intersectionc	Cs�dd�}dD]7}|�|�}dD]-}tttjtttfD]!}||�}|�|�}|||�}|�	||�|�
|dup9|du�qqqdS)NcSs	t|��|�Sr)r?rj)�s1�s2rrr
�f{sz'TestJointOps.test_isdisjoint.<locals>.f)
rgr<�abrTZababacrOrfrQrSrUTF)r4r?rJr6r7rZr[r\�
isdisjointrC�
assertTrue)	rrqZlargroZrargr^rprDrErrr
�test_isdisjointzs


���zTestJointOps.test_isdisjointcCsr|j�|j�}|�|jt|j�@|�|�|jt|j�@|�z|j|j@Wn
ty1YdSw|�d�dS)Nz(s&t did not screen-out general iterables)r5rjr2rCr?rJr>rarbrrr
�test_and�rezTestJointOps.test_andcCsf|j�|j�}|jD]}|�||v||jvo||jv�q
|�|j|�|j��|�t|�|j	�|�
t|jjt��|�
t
|jjgg�tttjtttfD]b}|�|�d��|d��td��|�|�d��|d��td��|�|�d��|d��td��|�|�d��|d��td��|�|�d���td��|�|�d��|d�|d	��td
��qNdS)NrNrOrrrQrTrSr<rUrirL)r5�
differencer2r3rCr8r4r1rXrYr=rrr>r?rJr6r7rZr[r\�rrcrLr^rrr
�test_difference�s
"    (�zTestJointOps.test_differencecCsr|j�|j�}|�|jt|j�|�|�|jt|j�|�z|j|jWn
ty1YdSw|�d�dS)Nz(s-t did not screen-out general iterables)r5rwr2rCr?rJr>rarbrrr
�test_sub�rezTestJointOps.test_subcCs&|j�|j�}|jD]}|�||v||jv||jvA�q
|�|j|�|j��|�t|�|j	�|�
t|jjt��|�
t
|jjgg�tttjtttfD]B}|�|�d��|d��td��|�|�d��|d��td��|�|�d��|d��td��|�|�d��|d��td	��qNdS)
NrNrO�abdrQrRrSr<rUrV)r5�symmetric_differencer2r3rCr8r4r1rXrYr=rrr>r?rJr6r7rZr[r\rxrrr
�test_symmetric_difference�s
"   "�z&TestJointOps.test_symmetric_differencecCsr|j�|j�}|�|jt|j�A|�|�|jt|j�A|�z|j|jAWn
ty1YdSw|�d�dS)Nz(s^t did not screen-out general iterables)r5r|r2rCr?rJr>rarbrrr
�test_xor�rezTestJointOps.test_xorcCs||�|jt|j��|�|jt|j��|�|j|jkd�|�|jt|j��|�|jt|j��|�|j|jkd�dS�NFT)rCr5r?r1rJrlr2rrrr
�
test_equality�szTestJointOps.test_equalitycCs,ttgd��}|�|�}|�t|�d�dS)N)ZabcdefZbcdZbdcbZfedZfedccba�)�maprJr4rCrG)r�tr5rrr
�test_setOfFrozensets�s
z!TestJointOps.test_setOfFrozensetscCs�t|jgd��\}}}|�||k�|�||k�|�||k�|�||k�|�||k�|�||k�|�||k�|�||k�|�||k�|�td��d��|�td��d��|�td��d��|�td��d��dS)N)rrZabcde�defr<rTZcbs)r�r4rtZassertFalser?�issubset�
issuperset)r�p�q�rrrr
�test_sub_and_super�szTestJointOps.test_sub_and_supercCs�ttjd�D]=}t�|j|�}t�|�}|�|j|d|j|f�t|j�tt	fvrDd|j_
t�|j|�}t�|�}|�|jj
|j
�qdS)Nr�%s != %s�
)�range�pickle�HIGHEST_PROTOCOL�dumpsr5�loadsrCrXr?rJr_)rrcr��duprrr
�
test_pickling�s

��zTestJointOps.test_picklingc	Cs�ttjd�D]X}t|j�}|�|j�}t�||�}t�|�}|�|t	j
j�|�|�|�|�t�|�}zt
|�}Wn	tyDYqwt�||�}t�|�}|�|�|�||�|f��qdSr)r�r�r��iterr5r4r�r�ZassertIsInstance�collectionsrT�IteratorrC�next�
StopIteration)r�protoZitorg�datar8�itZdroprrr
�test_iterator_pickling�s"


�
 �z#TestJointOps.test_iterator_picklingcs~G�fdd�d���d�}|�|g�}t�|�}|�t|�t|��|D]}|}q$|�t|�t|��|�|jd|j�dS)Ncs*eZdZdd�Zdd�Zd�fdd�	ZdS)	z*TestJointOps.test_deepcopy.<locals>.TracercS�
||_dSr�r$)rr$rrr
r-r&z3TestJointOps.test_deepcopy.<locals>.Tracer.__init__cSs|jSrr�rrrr
rsz3TestJointOps.test_deepcopy.<locals>.Tracer.__hash__Ncs�|jd�Srr�)r�memo��Tracerrr
�__deepcopy__
�z7TestJointOps.test_deepcopy.<locals>.Tracer.__deepcopy__r)r	r
rr-rr�rr�rr
r�sr�r�r)r4�copy�deepcopyrlrkrCr$)rr�r5r��elemZnewtrr�r
�
test_deepcopys
zTestJointOps.test_deepcopycsNGdd�d��t�fdd�td�D��}|D]}||_||_t|g�|_qdS)Nc@r)zTestJointOps.test_gc.<locals>.ANrrrrr
�Arr�c3��|]}��VqdSrr��.0rc�r�rr
�	<genexpr>��z'TestJointOps.test_gc.<locals>.<genexpr>��)r?r��cycle�sub)rr5r�rr�r
�test_gcs�zTestJointOps.test_gccCsVGdd�d|j�}|�}t�}|�|�|�||�|�|�|�|�|�|�dS)Nc@�eZdZdd�ZdS)z6TestJointOps.test_subclass_with_custom_hash.<locals>.HcSstt|�d@�S)Ni���)r.rkrrrr
r"�z?TestJointOps.test_subclass_with_custom_hash.<locals>.H.__hash__N)r	r
rrrrrr
�H!�r�)r4r?�addrK�remove�discard)rr�r5rqrrr
�test_subclass_with_custom_hashs


z+TestJointOps.test_subclass_with_custom_hashcCs�|�t�g�}|�t|jt�t�g�|�t|jt��t|d�r>|�t|jt��|�t|jt��|�t|jt��dSdS)Nr�)	r4rr=rrI�hasattrr�r�r��rr5rrr
�test_badcmp,s
�zTestJointOps.test_badcmpcCsdt�}|�|g�}||_|jtkr|�t|�d�dSt|��d�d}|�t|�d||f�dS)Nz
{set(...)}�(rz
%s({%s(...)}))r"r4r$r?rCr#�	partition)r�wr5�namerrr
�test_cyclical_repr7s
zTestJointOps.test_cyclical_reprcCs:d}t�ttt|���}|�tdd�|D��|�|�|�}|�tdd�|D��|�|�|�|�tdd�|D��|�t	|d�rG|�
|�|�tdd�|D��|�t�t|��}|�tdd�|D��|�t�t|��}|�td	d�|D��|�t�t|�d
�}|�tdd�|D��|�|�|t�|d
��dS)Nr�cs��|]}|jVqdSrr*�r�r�rrr
r�Dr�z<TestJointOps.test_do_not_rehash_dict_keys.<locals>.<genexpr>csr�rr*r�rrr
r�Fr�csr�rr*r�rrr
r�Hr��symmetric_difference_updatecsr�rr*r�rrr
r�Kr�csr�rr*r�rrr
r�Mr�csr�rr*r�rrr
r�Or��{csr�rr*r�rrr
r�Qr�)
r6r7r�r(r�rC�sumr4rwr�r�r?rJ)r�nr8r5Zd2Zd3rrr
�test_do_not_rehash_dict_keysAs"



z)TestJointOps.test_do_not_rehash_dict_keyscCsXGdd�dt�}|�}t�|�}t|dg�}t|�|_~~t��|�|�dud�dS)Nc@r)z/TestJointOps.test_container_iterator.<locals>.CNrrrrr
r^Vrr^rzCycle was not collected)	�object�weakref�refr?r�r_�gcZcollectrt)rr^�objr��	containerrrr
�test_container_iteratorTs

z$TestJointOps.test_container_iteratorcCst�|t|j�dSr)rZcheck_free_after_iteratingr�r4rrrr
�test_free_after_iterating`�z&TestJointOps.test_free_after_iteratingN)r	r
rr9r@rFrHrMr`rdrnrurvryrzr}r~r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r0)s8


r0c@s�eZdZeZeZdd�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Ze� e!ed3�d4�d5d6��Z"d7S)8�TestSetcCsj|��}|�|j�|�|t|j��|�|j�|�|t|j��|�t|j|d�|�t|jd�dS)Nr:r)r4r-r1rCr?r2r=r>r�rrr
�	test_initgszTestSet.test_initcC�0|�td��}|�|�}|�t|�t|��dS�Nr��r4r�rlrk�rr5r�rrr
�test_constructor_identityp�
z!TestSet.test_constructor_identitycCs$tgd��}hd�}|�||�dS)N�rr:r��rr:r��r?rCr�rrr
�test_set_literaluszTestSet.test_set_literalcCs4hd�}|�t|�d�|��}|�t|�t�dS)N>rr)rCrG�poprXr.)rr5Zstored_valuerrr
� test_set_literal_insertion_orderzsz(TestSet.test_set_literal_insertion_ordercs:g��fdd�}|d�|d�|d�h}|��gd��dS)Ncs��|�dSr)�append)r���eventsrr
�record�r�z9TestSet.test_set_literal_evaluation_order.<locals>.recordrr:r�r�)rC)rr�r5rr�r
�!test_set_literal_evaluation_order�sz)TestSet.test_set_literal_evaluation_ordercCs|�tt|j�dSr)r=r>�hashr5rrrr
�	test_hash�r�zTestSet.test_hashcCs0|j��|�|jt��|�t|j�d�dSr))r5�clearrCr?rGrrrr
�
test_clear�s
zTestSet.test_clearcCsD|j��}|�|j|�|�t|j�t|��|�t|�|j�dSr)r5r�rCrlrkrXrY�rr�rrr
�	test_copy�s
zTestSet.test_copycCsT|j�d�|�d|j�|j��}|j�d�|�|j|�|�t|jjg�dS)N�Q)r5r�rKr�rCr=r>r�rrr
�test_add�s
zTestSet.test_addcCs�|j�d�|�d|j�|�t|jjd�|�t|jjg�|�t|j�g�}|�	|�|j�|�|�|�|j��|�|�|j�|�|�t|jj|�|j��dS�Nr<r�)
r5r��assertNotInr=�KeyErrorr>r4rJr1rKr�rrr
�test_remove�szTestSet.test_removecCsbdD],}z|j�|�Wnty)}z|jd}|�||�WYd}~qd}~ww|��qdS)N)r��rr)r5r�r�r,rCra)r�v1�e�v2rrr
�test_remove_keyerror_unpacking�s
��
�z&TestSet.test_remove_keyerror_unpackingcCsv|�ddg�}z|j�|�Wn%ty4}z|�|jd|ud�||jd��WYd}~dSd}~ww|��dS)Nr��rzKeyError should be {0}, not {1})r4r5r�r�rtr,�formatra)r�keyr�rrr
�test_remove_keyerror_set�s����z TestSet.test_remove_keyerror_setcCs�|j�d�|�d|j�|j�d�|�t|jjg�|�t|j�g�}|�|�|j�|�|�|�|j��|�|�|j�|�|�|�|j��dSr�)	r5r�r�r=r>r4rJr1rKr�rrr
�test_discard�szTestSet.test_discardcCs@tt|j��D]}|j��}|�||j�q|�t|jj�dSr)r�rGr5r�r�r=r�)rrcr�rrr
�test_pop�s
zTestSet.test_popc	Cs(|j�|j�}|�|d�|j|jD]	}|�||j�q|�t|jjt��|�t	|jjgg�dD](\}}t
ttj
tttfD]}|�d�}|�|�||��d�|�|t
|��q@q3dD]3}d}t
ttj
tttfD]%}|�d�}|�|�||�||��d�|�|t
|�t
|�Bt
|�B�qkq^dS)N))rOrP�rQrR)rSrT�rUrVrN)rOrQrSrUZabcdaZahi)r5�updater2rCr1rKr=rrr>r?rJr6r7rZr[r\r4�r�retvalrLr�r�r^r5rrr
�test_update�s(
�
"��zTestSet.test_updatecCs8|jt|j�O_|j|jD]	}|�||j�qdSr)r5r?r2r1rK�rrLrrr
�test_ior�s�zTestSet.test_iorc		Cs.|j�|j�}|�|d�|j|jD]}||jvr'||jvr'|�||j�q|�||j�q|�t|jjt	��|�t
|jjgg�dD]O\}}ttt
jtttfD]A}|�d�}|�|�||��d�|�|t|��d}|�|�}d}|�|�||�||��d�|�|td�t|�@t|�@�qRqEdS)N))rOrL)rQrg)rSrh)rUrgrNZcbc)r5�intersection_updater2rCr1rKr�r=rrr>r?rJr6r7rZr[r\r4)	rrrLr�r�r^r5�ssr�rrr
�test_intersection_update�s(

"��z TestSet.test_intersection_updatecCs\|jt|j�M_|j|jD]}||jvr$||jvr$|�||j�q|�||j�qdSr�r5r?r2r1rKr�rrrr
�	test_iand���zTestSet.test_iandcCsr|j�|j�}|�|d�|j|jD]}||jvr'||jvr'|�||j�q|�||j�q|�t|jjt	��|�t
|jjgg�|�t
|jjgg�dD]g\}}tt
tjtttfD]Y}|�d�}|�|�||��d�|�|t|��|�d�}|��|�||�d��|�d�}|�|d��|�||�d��|�d�}|�|d�|d��|�||�d��q\qOdS)N))rOrr)rQrT�rSr<)rUrTrNZ
abcdefghihZabaZcdefghihrOZefghih)r5�difference_updater2rCr1rKr�r=rrr>r�r?rJr6r7rZr[r\r4rrrr
�test_difference_updates2



��zTestSet.test_difference_updatecCs\|jt|j�8_|j|jD]}||jvr$||jvr$|�||j�q|�||j�qdSrr	rrrr
�	test_isub#rzTestSet.test_isubcCs�|j�|j�}|�|d�|j|jD]}||jv||jvAr'|�||j�q|�||j�q|�t|jjt	��|�t
|jjgg�dD](\}}ttt
jtttfD]}|�d�}|�|�||��d�|�|t|��qRqEdS)N))rOr{r�rr�rN)r5r�r2rCr1rKr�r=rrr>r?rJr6r7rZr[r\r4rrrr
� test_symmetric_difference_update+s
��z(TestSet.test_symmetric_difference_updatecCs\|jt|j�N_|j|jD]}||jv||jvAr$|�||j�q|�||j�qdSrr	rrrr
�	test_ixor;rzTestSet.test_ixorcCst|j��}||O}|�||j�||M}|�||j�||8}|�||���|j��}||N}|�||���dSr)r5r�rCr4)rr�rrr
�test_inplace_on_selfCs

zTestSet.test_inplace_on_selfcCsF|�d�}t�|�}|�t|�t|��d}t��|�tt|�dS)NZgallahad)	r4r��proxyrCrZr�
gc_collectr=�ReferenceError)rr5r�rrr
�test_weakrefOs

zTestSet.test_weakrefcCs�Gdd�d�}hd�}|�}||k|�|j�|�}||k|�|j�|�}||k|�|j�|�}||k|�|j�dS)Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z5TestSet.test_rich_compare.<locals>.TestRichSetComparecS�
d|_dS�NTF)�	gt_called�rZsome_setrrr
�__gt__Y�z<TestSet.test_rich_compare.<locals>.TestRichSetCompare.__gt__cSrr)�	lt_calledrrrr
�__lt__\rz<TestSet.test_rich_compare.<locals>.TestRichSetCompare.__lt__cSrr)�	ge_calledrrrr
�__ge___rz<TestSet.test_rich_compare.<locals>.TestRichSetCompare.__ge__cSrr)�	le_calledrrrr
�__le__brz<TestSet.test_rich_compare.<locals>.TestRichSetCompare.__le__N)r	r
rrrr r"rrrr
�TestRichSetCompareXs
r#r�)rtrrrr!)rr#ZmysetZmyobjrrr
�test_rich_compareWszTestSet.test_rich_compare�
test_c_apiz*C API test only available in a debug buildcCs|�t���d�dS�NT)rCr?r%rrrr
r%{szTestSet.test_c_apiN)#r	r
rr?r4rYr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrrrrrr$�unittestZ
skipUnlessr�r%rrrr
r�cs@	$�r�c@r)�SetSubclassNrrrrr
r(�rr(c@�eZdZeZeZdS)�TestSetSubclassN)r	r
rr(r4r?rYrrrr
r*��r*c@seZdZgdfdd�ZdS)�SetSubclassWithKeywordArgsNcCst�||�dSr)r?r-)r�iterable�newargrrr
r-�r�z#SetSubclassWithKeywordArgs.__init__)r	r
rr-rrrr
r,�sr,c@r�)�TestSetSubclassWithKeywordArgscCs	tdd�dS)Nr)r.)r,rrrr
�test_keywords_in_subclass�sz8TestSetSubclassWithKeywordArgs.test_keywords_in_subclassN)r	r
rr0rrrr
r/�sr/c@sLeZdZeZeZdd�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)�
TestFrozenSetcCs.|�|j�}|�|j�|�|t|j��dSr)r4r1r-r2rCr?r�rrr
r��szTestFrozenSet.test_initcCr�r�)r4r�rCrkr�rrr
r��r�z'TestFrozenSet.test_constructor_identitycs~|�t|�d��t|�d���d��fdd�t��D�}t�}td�D]}t|�|�t|�|���q$|�t|�d�dS)NZabcdebZebecda�dcsg|]}t���qSr�rr��r�rr
�
<listcomp>��z+TestFrozenSet.test_hash.<locals>.<listcomp>��r)rCr�r4r�r?rr�rG)r�seq�resultsrcrr4r
r��s�zTestFrozenSet.test_hashcC�$|j��}|�t|j�t|��dSr)r5r�rCrkr�rrr
r���
zTestFrozenSet.test_copycCsrttd��td�dg}|�|�}|�t|��}|�||�|�t|�t|��i}d||<|�||d�dS)Nr�ZabcdefgZapple�*)r[r�r4�reversedrCrlrk)rr8Zkey1Zkey2r8rrr
�test_frozen_as_dictkey�s
z$TestFrozenSet.test_frozen_as_dictkeycCs"|�d�}|�t|�t|��dS)NZabcdcda)r4rCr��rrqrrr
�test_hash_caching�s
zTestFrozenSet.test_hash_cachingc
	s�d}t�}|j}dd�t|�D�}td|�D]�|tt�fdd�|D����q|�t|�d|�dd�}dd	�}td
�D]+}d|}|d�t|fD]}t�fdd
�tt|||���D��}	|�d|	|�qMq?dS)N�
cSsg|]
}|dd|>f�qSr�rr�rrr
r5��z9TestFrozenSet.test_hash_effectiveness.<locals>.<listcomp>r:csg|]
\}}|�@r|�qSrr)r�r��m�rcrr
r5�rBcSs8t�g}t|d�D]}t|�}|�|�q
|d|�Sr)rJr�r�)r��numsrc�numrrr
�zf_range�s
z7TestFrozenSet.test_hash_effectiveness.<locals>.zf_rangecss4�tt|�d�D]}ttt�||��EdHq	dSr)r�rGr�rJ�	itertools�combinations)r5rcrrr
�powerset�s��z7TestFrozenSet.test_hash_effectiveness.<locals>.powerset�rcsh|]}|�@�qSrr)r��h)�maskrr
�	<setcomp>�r6z8TestFrozenSet.test_hash_effectiveness.<locals>.<setcomp>r�)	r?r�r�r�rJrCrGr�Z
assertGreater)
rr�Z
hashvaluesZaddhashvalueZ	elemmasksrGrJr�rEr]r)rcrMr
�test_hash_effectiveness�s" $��z%TestFrozenSet.test_hash_effectivenessN)
r	r
rrJr4rYr�r�r�r�r>r@rOrrrr
r1�s

r1c@r)�FrozenSetSubclassNrrrrr
rP�rrPc@s4eZdZeZeZdd�Zdd�Zdd�Z	dd�Z
d	S)
�TestFrozenSetSubclasscCr�r�r�r�rrr
r��r�z/TestFrozenSetSubclass.test_constructor_identitycCr:r)r5r�rlrkr�rrr
r��r;zTestFrozenSetSubclass.test_copycCs"|��}|�|�}|�||�dSr)r4rCr�rrr
�test_nested_empty_constructor�s
z3TestFrozenSetSubclass.test_nested_empty_constructorcCs�|j}t�}|�}|�|g�|d�|d�|�|g�|d�|d�|td��||��|t��||||�||�g}|�tttt|���t|��dS)Nrrgr)r4rJr�rCrGr?r�rk)rZ	Frozensetrq�FZefsrrr
�test_singleton_empty_frozenset�s�"z4TestFrozenSetSubclass.test_singleton_empty_frozensetN)r	r
rrPr4rJrYr�r�rRrTrrrr
rQ�srQc@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#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/S)0�TestBasicOpscCs&|jdur|�t|j�|j�dSdSr)r#rCr?rrrr
�	test_reprs
�zTestBasicOps.test_reprcCslt|j�}|�|�d��|�|�d��|dd��d�}|��dd�|jD�}|��|�||�dS)N�{�}r���z, cSsg|]}t|��qSr)r#)r�r$rrr
r5
r6z:TestBasicOps.check_repr_against_values.<locals>.<listcomp>)	r#r?rt�
startswith�endswith�split�sort�valuesrC)r�text�resultZsorted_repr_valuesrrr
�check_repr_against_valuess
z&TestBasicOps.check_repr_against_valuescCs|�t|j�|j�dSr)rCrGr?�lengthrrrr
�test_length�zTestBasicOps.test_lengthcCs|�|j|j�dSr�rCr?rrrr
�test_self_equalityr�zTestBasicOps.test_self_equalitycCs|�|j|j�dSr)rCr?r�rrrr
�test_equivalent_equalityr�z%TestBasicOps.test_equivalent_equalitycCs|�|j��|j�dSr)rCr?r�r�rrrr
r�rdzTestBasicOps.test_copycCs|j|jB}|�||j�dSr�r?rCr��rr`rrr
�test_self_union�zTestBasicOps.test_self_unioncCs|jtB}|�||j�dSr�r?�	empty_setrCr�rirrr
�test_empty_union!�
zTestBasicOps.test_empty_unioncCst|jB}|�||j�dSr)rmr?rCr�rirrr
�test_union_empty%rozTestBasicOps.test_union_emptycCs|j|j@}|�||j�dSrrhrirrr
�test_self_intersection)rkz#TestBasicOps.test_self_intersectioncCs|jt@}|�|t�dSr�r?rmrCrirrr
�test_empty_intersection-�
z$TestBasicOps.test_empty_intersectioncCst|j@}|�|t�dSr�rmr?rCrirrr
�test_intersection_empty1rtz$TestBasicOps.test_intersection_emptycCs"|j�|j�}|�||j�dSr�r?rsrCrirrr
�test_self_isdisjoint5�z!TestBasicOps.test_self_isdisjointcCs|j�t�}|�|d�dSr&)r?rsrmrCrirrr
�test_empty_isdisjoint9�z"TestBasicOps.test_empty_isdisjointcCst�|j�}|�|d�dSr&)rmrsr?rCrirrr
�test_isdisjoint_empty=r{z"TestBasicOps.test_isdisjoint_emptycCs|j|jA}|�|t�dSr�r?rCrmrirrr
�test_self_symmetric_differenceAr{z+TestBasicOps.test_self_symmetric_differencecCs|jtA}|�||j�dSrrrrirrr
�test_empty_symmetric_differenceEroz,TestBasicOps.test_empty_symmetric_differencecCs|j|j}|�|t�dSrr}rirrr
�test_self_differenceIr{z!TestBasicOps.test_self_differencecCs|jt}|�||j�dSrrlrirrr
�test_empty_differenceMroz"TestBasicOps.test_empty_differencecCst|j}|�|t�dSrrurirrr
�test_empty_difference_revQrtz&TestBasicOps.test_empty_difference_revcCs>|jD]	}|�||j�qt|j�}|�|��t|j��dSr)r?rKr^r�rC�__length_hint__rG)r�vZsetiterrrr
�test_iterationUs

zTestBasicOps.test_iterationcCsJttjd�D]}t�|j|�}t�|�}|�|j|d|j|f�qdS)Nrr�)r�r�r�r�r?r�rC)rr�r�r�rrr
r�[s

��zTestBasicOps.test_picklingcCsr|�t��t��d�Wd�n1swY|�t��t��d�Wd�dS1s2wYdS)Nr�)r=r>r?rwr
rrrr
�test_issue_37219bs�"�zTestBasicOps.test_issue_37219N)r	r
rrVrarcrfrgr�rjrnrprqrsrvrxrzr|r~rr�r�r�r�r�r�rrrr
rUs0rUc@r�)�TestBasicOpsEmptycCs4d|_g|_t|j�|_t|j�|_d|_d|_dS)Nz	empty setrzset()��caser^r?r�rbr#rrrr
r9ks
zTestBasicOpsEmpty.setUpN�r	r
rr9rrrr
r�jr�r�c@�$eZdZdd�Zdd�Zdd�ZdS)�TestBasicOpsSingletoncC�6d|_dg|_t|j�|_t|j�|_d|_d|_dS)Nzunit set (number)r�rz{3}r�rrrr
r9v�
zTestBasicOpsSingleton.setUpcC�|�d|j�dSr��rKr?rrrr
�test_in~�zTestBasicOpsSingleton.test_incCr��Nr:�r�r?rrrr
�test_not_in�r�z!TestBasicOpsSingleton.test_not_inN�r	r
rr9r�r�rrrr
r�u�r�c@r�)�TestBasicOpsTuplecCr�)Nzunit set (tuple)�r�zerorz
{(0, 'zero')}r�rrrr
r9�r�zTestBasicOpsTuple.setUpcCr�)Nr�r�rrrr
r��r�zTestBasicOpsTuple.test_incCr�)N�	r�rrrr
r��r�zTestBasicOpsTuple.test_not_inNr�rrrr
r��r�r�c@r�)�TestBasicOpsTriplecCs<d|_ddtjg|_t|j�|_t|j�|_d|_d|_dS)Nz
triple setrr�r�)r��operatorr�r^r?r�rbr#rrrr
r9�s
zTestBasicOpsTriple.setUpNr�rrrr
r��r�r�c@r)�TestBasicOpsStringcC�2d|_gd�|_t|j�|_t|j�|_d|_dS)Nz
string set�r<rirLr��r�r^r?r�rbrrrr
r9��


zTestBasicOpsString.setUpcC�|��dSr�rarrrr
rV��zTestBasicOpsString.test_reprN�r	r
rr9rVrrrr
r���r�c@r)�TestBasicOpsBytescCr�)Nz	bytes set)�a�b�cr�r�rrrr
r9�r�zTestBasicOpsBytes.setUpcCr�rr�rrrr
rV�r�zTestBasicOpsBytes.test_reprNr�rrrr
r��r�r�c@r�)�TestBasicOpsMixedStringBytescCsRt��|_|j��t�dt�d|_gd�|_t	|j�|_	t	|j�|_
d|_dS)N�ignorezstring and bytes set)r<rir�r�r�)rZcheck_warnings�_warning_filters�	__enter__�warnings�simplefilter�BytesWarningr�r^r?r�rbrrrr
r9�s



z"TestBasicOpsMixedStringBytes.setUpcCs|j�ddd�dSr)r��__exit__rrrr
�tearDown�r�z%TestBasicOpsMixedStringBytes.tearDowncCr�rr�rrrr
rV�r�z&TestBasicOpsMixedStringBytes.test_reprN)r	r
rr9r�rVrrrr
r��s
r�ccrr)r>rrrr
�baditer�rr�ccs�dVdSr&rrrrr
�gooditer�s�
r�c@�&eZdZ	dd�Zdd�Zdd�ZdS)�TestExceptionPropagationcCs|�ttt��dSr)r=r>r?r�rrrr
�test_instanceWithException�r�z3TestExceptionPropagation.test_instanceWithExceptioncCsFtgd��td�tdddd��ttd��td�tt��dS)Nr�rr:r�)ZoneZtwoZthreerT)r?r�r�rrrr
�test_instancesWithoutException�sz7TestExceptionPropagation.test_instancesWithoutExceptioncCsJtgd��}z
|D]}|�dg�q	Wn
tyYdSw|�d�dS)Nr�r�z0no exception when changing size during iteration)r?rrra)rr5rcrrr
�test_changingSizeWhileIterating�s��z8TestExceptionPropagation.test_changingSizeWhileIteratingN)r	r
rr�r�r�rrrr
r��s
	r�c@r�)�
TestSetOfSetscCs\tdg�}t|g�}|��}|�t|�t�|�|�|�|�|�|t��|�|�dSr)rJr?r�rCrXr�r�r�)r�innerZouter�elementrrr
�test_constructor�s



zTestSetOfSets.test_constructorN)r	r
rr�rrrr
r��r�r�c@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#d$�Zd%S)&�
TestBinaryOpscC�td�|_dS�N�r:r���r?rrrr
r9�r�zTestBinaryOps.setUpcCs|�|jtdddd���dS)Nrr��r�rerrrr
�test_eqszTestBinaryOps.test_eqcCs$|jtdg�B}|�|td��dS�Nr:r�r�rirrr
�test_union_subsetszTestBinaryOps.test_union_subsetcCs*|jtgd��B}|�|tgd���dS�N�r:r�r��r�rirrr
�test_union_superset	rAz!TestBinaryOps.test_union_supersetcCs*|jtgd��B}|�|tgd���dS�N�r�r�r�)r:r�r�r�r�r�rirrr
�test_union_overlap
rAz TestBinaryOps.test_union_overlapcCs(|jtdg�B}|�|tgd���dS�Nr�r�r�rirrr
�test_union_non_overlap�z$TestBinaryOps.test_union_non_overlapcCs"|jtd�@}|�|td��dS�N�r:r�r�rirrr
�test_intersection_subsetryz&TestBinaryOps.test_intersection_subsetcCs*|jtgd��@}|�|tgd���dS�Nr�r�r�rirrr
�test_intersection_supersetrAz(TestBinaryOps.test_intersection_supersetcCs(|jtgd��@}|�|tdg��dS�Nr�r�r�rirrr
�test_intersection_overlap�z'TestBinaryOps.test_intersection_overlapcCs |jtdg�@}|�|t�dS�Nr�r}rirrr
�test_intersection_non_overlap!�z+TestBinaryOps.test_intersection_non_overlapcCs |j�td��}|�|d�dS)Nr�Frwrirrr
�test_isdisjoint_subset%r�z$TestBinaryOps.test_isdisjoint_subsetcC�$|j�tgd���}|�|d�dS)Nr�Frwrirrr
�test_isdisjoint_superset)�z&TestBinaryOps.test_isdisjoint_supersetcCr�)Nr�Frwrirrr
�test_isdisjoint_overlap-r�z%TestBinaryOps.test_isdisjoint_overlapcCs"|j�tdg��}|�|d�dS)Nr�Trwrirrr
�test_isdisjoint_non_overlap1sz)TestBinaryOps.test_isdisjoint_non_overlapcC�$|jtd�A}|�|tdg��dS�Nr�r�r�rirrr
�test_sym_difference_subset5�z(TestBinaryOps.test_sym_difference_subsetcCr��Nr�r�r�rirrr
�test_sym_difference_superset9r�z*TestBinaryOps.test_sym_difference_supersetcCs&|jtd�A}|�|tgd���dS�Nr�)r:r�r�r�r�rirrr
�test_sym_difference_overlap=sz)TestBinaryOps.test_sym_difference_overlapcCs(|jtdg�A}|�|tgd���dSr�r�rirrr
�test_sym_difference_non_overlapAr�z-TestBinaryOps.test_sym_difference_non_overlapN)r	r
rr9r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r��s&r�c@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#d$�Zd%d&�Zd'd(�Zd)d*�Zd+S),�
TestUpdateOpscCr�r�r�rrrr
r9Hr�zTestUpdateOps.setUpcCs*|jtdg�O_|�|jtd��dSr�r�rrrr
r�KszTestUpdateOps.test_union_subsetcCs0|jtgd��O_|�|jtgd���dSr�r�rrrr
r�O�z!TestUpdateOps.test_union_supersetcCs0|jtgd��O_|�|jtgd���dSr�r�rrrr
r�Sr�z TestUpdateOps.test_union_overlapcCs.|jtdg�O_|�|jtgd���dSr�r�rrrr
r�W�z$TestUpdateOps.test_union_non_overlapcC�.|j�tgd���|�|jtgd���dSr�)r?rrCrrrr
�test_union_method_call[r�z$TestUpdateOps.test_union_method_callcCs(|jtd�M_|�|jtd��dSr�r�rrrr
r�_r�z&TestUpdateOps.test_intersection_subsetcCs0|jtgd��M_|�|jtgd���dSr�r�rrrr
r�cr�z(TestUpdateOps.test_intersection_supersetcCs.|jtgd��M_|�|jtdg��dSr�r�rrrr
r�gsz'TestUpdateOps.test_intersection_overlapcCs&|jtdg�M_|�|jt�dSr�r}rrrr
r�ksz+TestUpdateOps.test_intersection_non_overlapcCs,|j�tgd���|�|jtdg��dSr�)r?rrCrrrr
�test_intersection_method_callosz+TestUpdateOps.test_intersection_method_callcC�*|jtd�N_|�|jtdg��dSr�r�rrrr
r�srAz(TestUpdateOps.test_sym_difference_subsetcCr�r�r�rrrr
r�wrAz*TestUpdateOps.test_sym_difference_supersetcCs,|jtd�N_|�|jtgd���dSr�r�rrrr
r�{�z)TestUpdateOps.test_sym_difference_overlapcCs.|jtdg�N_|�|jtgd���dSr�r�rrrr
r�r�z-TestUpdateOps.test_sym_difference_non_overlapcCr�r�)r?r�rCrrrr
�test_sym_difference_method_call�r�z-TestUpdateOps.test_sym_difference_method_callcCs*|jtd�8_|�|jtdg��dSr�r�rrrr
�test_difference_subset�rAz$TestUpdateOps.test_difference_subsetcCs(|jtd�8_|�|jtg��dSr�r�rrrr
�test_difference_superset�r�z&TestUpdateOps.test_difference_supersetcCs,|jtd�8_|�|jtddg��dS�Nr�r:r�r�rrrr
�test_difference_overlap�r�z%TestUpdateOps.test_difference_overlapcCs.|jtdg�8_|�|jtgd���dS)Nr�r�r�rrrr
�test_difference_non_overlap�r�z)TestUpdateOps.test_difference_non_overlapcCs.|j�tgd���|�|jtddg��dSr�)r?r
rCrrrr
�test_difference_method_call�r�z)TestUpdateOps.test_difference_method_callN)r	r
rr9r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r�Gs,r�c@�|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�
TestMutatecCsgd�|_t|j�|_dS)Nr�)r^r?rrrr
r9�rtzTestMutate.setUpcC�"|j�d�|�|jtd��dS)NrLrT�r?r�rCrrrr
�test_add_present��zTestMutate.test_add_presentcCr�)Nr8rPrrrrr
�test_add_absent�rzTestMutate.test_add_absentcCsJt�}d}|jD]}|�|�|d7}|�t|�|�q|�||j�dS)Nrr)r?r^r�rCrG)r�tmp�expected_lenr�rrr
�test_add_until_full�s

zTestMutate.test_add_until_fullcCr�)NriZac)r?r�rCrrrr
�test_remove_present�rzTestMutate.test_remove_presentcCs2z|j�d�|�d�WdStyYdSw)Nr8z7Removing missing element should have raised LookupError)r?r�ra�LookupErrorrrrr
�test_remove_absent�s�zTestMutate.test_remove_absentcCs@t|j�}|jD]}|j�|�|d8}|�t|j�|�qdSr)rGr?r^r�rC)rrr�rrr
�test_remove_until_empty�s

�z"TestMutate.test_remove_until_emptycCr�)NrLrr�r?r�rCrrrr
�test_discard_present�rzTestMutate.test_discard_presentcCr�)Nr8rTrrrrr
�test_discard_absent�rzTestMutate.test_discard_absentcCs |j��|�t|j�d�dSr))r?r�rCrGrrrr
r��s
zTestMutate.test_clearcCsPi}|jrd||j��<|js|�t|�t|j��|jD]}|�||�qdSr)r?r�rCrGr^rK)rZpoppedr�rrr
r��s�
�zTestMutate.test_popcC�$|j�d�|�|jt|j��dS)Nr�r?rrCr^rrrr
�test_update_empty_tuple��z"TestMutate.test_update_empty_tuplecCr)Nr;rrrrr
�test_update_unit_tuple_overlap�rz)TestMutate.test_update_unit_tuple_overlapcCs*|j�d�|�|jt|jdg��dS)N)r<rmrmrrrrr
�"test_update_unit_tuple_non_overlap�sz-TestMutate.test_update_unit_tuple_non_overlapN)r	r
rr9rrrrr	r
rr
r�r�rrrrrrr
r��s	r�c@s0eZdZddd�Zdddddd	d
�Zdd�Zd
S)�TestSubsetsr�r�)�<=�>=�==�!=�>�<rr)rrrrrrcCs�|j}|j}dD]Z}||jv}td|dt��}|�||�|tjvr6t|tj|�}||�}|�||�tj	|}td|dt��}|�||�|tjvrbt|tj|�}||�}|�||�qdS)N)rrrrrrr_�y)
�left�right�cases�eval�localsrCr�case2method�getattr�reverse)rr_rr�rEr`�methodZrcaserrr
�
test_issubset�s&



��zTestSubsets.test_issubsetN)r	r
rr!r#r%rrrr
r�s��rc@s eZdZe�Ze�ZdZdZdS)�TestSubsetEqualEmptyz
both empty�rrrN�r	r
rr?rrr�rrrrr
r&
s
r&c@s,eZdZeddg�Zeddg�ZdZdZdS)�TestSubsetEqualNonEmptyrr:z
equal pairr'Nr(rrrr
r)s
r)c@s&eZdZe�Zeddg�ZdZdZdS)�TestSubsetEmptyNonEmptyrr:zone empty, one non-empty�rrrNr(rrrr
r*s
r*c@s*eZdZedg�Zeddg�ZdZdZdS)�TestSubsetPartialrr:z&one a non-empty proper subset of otherr+Nr(rrrr
r,%s

r,c@s(eZdZedg�Zedg�ZdZdZdS)�TestSubsetNonOverlaprr:zneither empty, neither containsrNr(rrrr
r--s


r-c@r�)�TestOnlySetsInBinaryOpscCsT|�|j|jkd�|�|j|jkd�|�|j|jkd�|�|j|jkd�dSr)rCrr?rrrr
�
test_eq_ne7sz"TestOnlySetsInBinaryOps.test_eq_necs���t�fdd����t�fdd����t�fdd����t�fdd����t�fdd����t�fdd����t�fdd����t�fd	d��dS)
Nc��j�jkSr�r?rrrrr
�<lambda>?�z:TestOnlySetsInBinaryOps.test_ge_gt_le_lt.<locals>.<lambda>c��j�jkSrr1rrrr
r2@r3c��j�jkSrr1rrrr
r2Ar3c��j�jkSrr1rrrr
r2Br3cr0r�rr?rrrr
r2Dr3cr4rr7rrrr
r2Er3cr5rr7rrrr
r2Fr3cr6rr7rrrr
r2Gr3)r=r>rrrr
�test_ge_gt_le_lt>sz(TestOnlySetsInBinaryOps.test_ge_gt_le_ltcCs8z
|j|jO_Wn
tyYdSw|�d�dS�Nzexpected TypeError�r?rr>rarrrr
�test_update_operatorI��z,TestOnlySetsInBinaryOps.test_update_operatorcC�0|jr|j�|j�dS|�t|jj|j�dSr)�otherIsIterabler?rrr=r>rrrr
rQsz#TestOnlySetsInBinaryOps.test_updatec�X��t�fdd����t�fdd���jr �j��j�dS��t�jj�j�dS)Nc��j�jBSrr1rrrr
r2Xr3z4TestOnlySetsInBinaryOps.test_union.<locals>.<lambda>cr@rr7rrrr
r2Yr3)r=r>r>r?rWrrrrr
r`W�
z"TestOnlySetsInBinaryOps.test_unioncCs8z
|j|jM_Wn
tyYdSw|�d�dSr9r:rrrr
�!test_intersection_update_operator_r<z9TestOnlySetsInBinaryOps.test_intersection_update_operatorcCr=r)r>r?rrr=r>rrrr
rg��z0TestOnlySetsInBinaryOps.test_intersection_updatecr?)Nc��j�j@Srr1rrrr
r2pr3z;TestOnlySetsInBinaryOps.test_intersection.<locals>.<lambda>crDrr7rrrr
r2qr3)r=r>r>r?rjrrrrr
rnorAz)TestOnlySetsInBinaryOps.test_intersectioncCs8z
|j|jN_Wn
tyYdSw|�d�dSr9r:rrrr
�#test_sym_difference_update_operatorwr<z;TestOnlySetsInBinaryOps.test_sym_difference_update_operatorcCr=r)r>r?r�rr=r>rrrr
�test_sym_difference_updaterCz2TestOnlySetsInBinaryOps.test_sym_difference_updatecr?)Nc��j�jASrr1rrrr
r2�r3z=TestOnlySetsInBinaryOps.test_sym_difference.<locals>.<lambda>crGrr7rrrr
r2�r3)r=r>r>r?r|rrrrr
�test_sym_difference�rAz+TestOnlySetsInBinaryOps.test_sym_differencecCs8z
|j|j8_Wn
tyYdSw|�d�dSr9r:rrrr
�test_difference_update_operator�r<z7TestOnlySetsInBinaryOps.test_difference_update_operatorcCr=r)r>r?r
rr=r>rrrr
r�rCz.TestOnlySetsInBinaryOps.test_difference_updatecr?)Nc��j�jSrr1rrrr
r2�r3z9TestOnlySetsInBinaryOps.test_difference.<locals>.<lambda>crJrr7rrrr
r2�r3)r=r>r>r?rwrrrrr
ry�rAz'TestOnlySetsInBinaryOps.test_differenceN)r	r
rr/r8r;rr`rBrrnrErFrHrIrryrrrr
r.5sr.c@r�)�TestOnlySetsNumericcC�td�|_d|_d|_dS)Nr��F�r?rr>rrrr
r9��

zTestOnlySetsNumeric.setUpNr�rrrr
rK�r�rKc@r�)�TestOnlySetsDictcCs td�|_ddd�|_d|_dS)Nr�r:r�)rr�TrNrrrr
r9�s

zTestOnlySetsDict.setUpNr�rrrr
rP�r�rPc@r�)�TestOnlySetsOperatorcCstd�|_tj|_d|_dS)Nr�F)r?r�r�rr>rrrr
r9�s

zTestOnlySetsOperator.setUpNr�rrrr
rQ�r�rQc@r�)�TestOnlySetsTuplecCrL)Nr�r�TrNrrrr
r9�rOzTestOnlySetsTuple.setUpNr�rrrr
rR�r�rRc@r�)�TestOnlySetsStringcCrL)Nr�rTTrNrrrr
r9�rOzTestOnlySetsString.setUpNr�rrrr
rS�r�rSc@r�)�TestOnlySetsGeneratorcCs$dd�}td�|_|�|_d|_dS)Ncss�tddd�D]}|VqdS)Nrr�r:)r�rDrrr
�gen�s��z(TestOnlySetsGenerator.setUp.<locals>.genr�TrN)rrUrrr
r9�s

zTestOnlySetsGenerator.setUpNr�rrrr
rT�r�rTc@r)�TestCopyingcCsd|j��}t|td�}t|jtd�}|�t|�t|��tt|��D]
}|�||||u�q"dS�N�r�)r?r�rBr#rCrGr�rt�rr�Zdup_listZset_listrcrrr
r��s
�zTestCopying.test_copycCsdt�|j�}t|td�}t|jtd�}|�t|�t|��tt|��D]}|�||||�q#dSrW)r�r�r?rBr#rCrGr�rYrrr
�test_deep_copy�s�zTestCopying.test_deep_copyN)r	r
rr�rZrrrr
rV�srVc@r�)�TestCopyingEmptycCst�|_dSrr�rrrr
r9�r�zTestCopyingEmpty.setUpNr�rrrr
r[�r�r[c@r�)�TestCopyingSingletoncC�tdg�|_dS)NZhellor�rrrr
r9�r�zTestCopyingSingleton.setUpNr�rrrr
r\�r�r\c@r�)�TestCopyingTriplecCstgd��|_dS)N)r�rNr�rrrr
r9�r�zTestCopyingTriple.setUpNr�rrrr
r^�r�r^c@r�)�TestCopyingTuplecCr])N�rr:r�rrrr
r9r�zTestCopyingTuple.setUpNr�rrrr
r_r�r_c@r�)�TestCopyingNestedcCr])N)r`)r�r�r�rrrr
r9
r�zTestCopyingNested.setUpNr�rrrr
ra	r�rac@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestIdentitiescCstd�|_td�|_dS)NZabracadabraZalacazam)r?r<rirrrr
r9s
zTestIdentities.setUpcCs�|j|j}}|�|||k�|�|||k�|�||@|k�|�||@|k�|�||B|k�|�||B|k�|�||A||Bk�dSr)r<rirt�rr<rirrr
�test_binopsVsSubsetssz#TestIdentities.test_binopsVsSubsetscCsn|j|j}}|�||@||@�|�||B||B�|�||A||A�||kr5|�||||�dSdSr)r<rirCrlrcrrr
�test_commutativitys�z!TestIdentities.test_commutativitycCs�|j|j}}|�||||@B||B||B�|�||@||AB||B�|�|||B||B�|�|||B||B�|�||||@B|�|�||||@B|�|�||||B||A�dSr)r<rirCrcrrr
�test_summations&s$ zTestIdentities.test_summationscCsZ|j|jt�}}}|�|||@|�|�|||@|�|�||@||A@|�dSr)r<rir?rC)rr<rir�rrr
�test_exclusion1szTestIdentities.test_exclusionN)r	r
rr9rdrerfrgrrrr
rbs
rbccs�	|D]}|VqdSrr��seqnrcrrr
�R:s
��rjc@r')�GcCr�r�ri�rrirrr
r-Ar&z
G.__init__cCs
|j|Srrlrbrrr
�__getitem__Cr&z
G.__getitem__N)r	r
rr-rnrrrr
rk?r/rkc@r�)�IcC�||_d|_dSr)rhrmrrr
r-H�
z
I.__init__cC�|Srrrrrr
�__iter__Krz
I.__iter__cC�2|jt|j�kr
t�|j|j}|jd7_|Sr�rcrGrir��rr�rrr
�__next__M�z
I.__next__N�r	r
rr-rsrwrrrr
roF�
roc@r')�IgcCrpr)rhrmrrr
r-UrqzIg.__init__ccs�|jD]}|VqdSrrl)r�valrrr
rsXs�
�zIg.__iter__N�r	r
rr-rsrrrr
r{S�r{c@r')�XcCrpr)rhrmrrr
r-^rqz
X.__init__cCrtrrurvrrr
rwarxz
X.__next__N)r	r
rr-rwrrrr
r\r~rc@r')�NcCrpr)rhrmrrr
r-irqz
N.__init__cCrrrrrrrr
rslrz
N.__iter__Nr}rrrr
r�gr~r�c@r�)�EcCrpr)rhrmrrr
r-qrqz
E.__init__cCrrrrrrrr
rstrz
E.__iter__cCsdddS)Nr�rrrrrr
rwvr�z
E.__next__Nryrrrr
r�orzr�c@r�)�ScCsdSrrrmrrr
r-{rz
S.__init__cCrrrrrrrr
rs}rz
S.__iter__cCrr)r�rrrr
rwrz
S.__next__Nryrrrr
r�ys
r�)�chaincCs 	ttdd�ttt|�����S)NcSrrrr�r_rrr
r2�szL.<locals>.<lambda>)r�r�rjr{rkrlrrr
�L�sr�c@r�)�TestVariousIteratorArgsc
Cs�ttfD]L}ddtd�dtddd�fD]<}ttttttfD]}|�	t
|||��td�t
||�td��q|�t
|t|��|�t
|t|��|�t|t|��qqdS)	N�123rgr��Zdog333333�?���r�rX)r?rJr�rkror{r�r�rjrCrBr#r=r>rr��ZeroDivisionErrorr�)rZconsr5�grrr
r��s*��z(TestVariousIteratorArgs.test_constructorc
Cs�td�}ddtd�dtddd�d	fD]Z}|j|j|j|j|jfD]K}ttt	t
tfD]&}||�}|||��}t|t
�rA|�||�q)|�t|td
�t|td
��q)|�t|t|��|�t|t|��|�t|t|��q qdS)NZnovemberr�rgr�r�r�r�r��decemberrX)r?r�rWrjrwr|rsrkror{r�rj�
isinstance�boolrCrBr#r=r>rr�r�r�)rr5r��methr�rErDrrr
�test_inline_methods�s 
��z+TestVariousIteratorArgs.test_inline_methodsc
Cs�ddtd�dtddd�dfD]f}d	D]a}ttttttfD],}td
�}|��}t	||�t
||���t	||�||��|�t|t
d�t|t
d��q|�tt	td
�|�t|��|�tt	td
�|�t|��|�tt	td
�|�t|��qqdS)Nr�rgr�r�r�r�r�r�)rrr
r�ZjanuaryrX)r�rkror{r�r�rjr?r�r"r[rCrBr#r=r>rr�r�r�)rr�Zmethnamer�r5r�rrr
�test_inplace_methods�s ��z,TestVariousIteratorArgs.test_inplace_methodsN)r	r
rr�r�r�rrrr
r��s	r�c@r)�bad_eqcCstrt��t�||uSr)�be_bad�set2r�r�rrrr
r �sz
bad_eq.__eq__cCrr)rrrrr
r�rzbad_eq.__hash__N�r	r
rr rrrrr
r��sr�c@r)�bad_dict_clearcCstrt��||uSr)r��dict2r�rrrr
r �szbad_dict_clear.__eq__cCrr)rrrrr
r�rzbad_dict_clear.__hash__Nr�rrrr
r��sr�c@r�)�
TestWeirdBugscCsZdat�h}dd�td�D�ada|�t|jt�dat�h}t�diada|�	t�dS)NFcSsh|]}t��qSr)r�r�rrr
rN��z4TestWeirdBugs.test_8420_set_merge.<locals>.<setcomp>�KT)
r�r�r�r�r=r�rr�r�r�)r�set1rrr
�test_8420_set_merge�s
z!TestWeirdBugs.test_8420_set_mergecCsXttd��}|��|�td��t|�}|��ttd��}|�td��t|�dS)Nr2)r?r�r�rr�r[)rr5�sir<rrr
�test_iter_and_mutate�sz"TestWeirdBugs.test_iter_and_mutatecsBG�fdd�d��t���fdd�td�D��dh}|���dS)Ncs eZdZdd�Z�fdd�ZdS)z.TestWeirdBugs.test_merge_and_mutate.<locals>.XcS�td�Sr))r�rrrr
r��z7TestWeirdBugs.test_merge_and_mutate.<locals>.X.__hash__cs���dS)NF)r�)r�o�rrr
r �sz5TestWeirdBugs.test_merge_and_mutate.<locals>.X.__eq__Nr!rr�rr
r�srcsh|]}���qSrrr�)rrr
rN�r�z6TestWeirdBugs.test_merge_and_mutate.<locals>.<setcomp>r�r)r?r�rr�r)rrr
�test_merge_and_mutate�s
z#TestWeirdBugs.test_merge_and_mutateN)r	r
rr�r�r�rrrr
r��sr�c@s&eZdZ	dZdZdd�Zdd�ZdS)�TestOperationsMutatingNcsfG���fdd�d��d�|��fdd�ttd��D���|��fdd�ttd��D���d���fS)	Ncs$eZdZ���fdd�Zdd�ZdS)z<TestOperationsMutating.make_sets_of_bad_objects.<locals>.Badcs<�sdStd�dkr���td�dkr���ttd��S)NF�rr:)rr�r�r��enabledr�r�rr
r �szCTestOperationsMutating.make_sets_of_bad_objects.<locals>.Bad.__eq__cSr�r�r3rrrr
r�r�zETestOperationsMutating.make_sets_of_bad_objects.<locals>.Bad.__hash__Nr�rr�rr
�Bad�sr�Fc3r�rr�r��_�r�rr
r��r�zBTestOperationsMutating.make_sets_of_bad_objects.<locals>.<genexpr>�2c3r�rrr�r�rr
r��r�T)�constructor1r�r�constructor2rr)r�r�r�r�r
�make_sets_of_bad_objects�s  z/TestOperationsMutating.make_sets_of_bad_objectscCs`td�D])}|��\}}z|||�Wqty-}z|�dt|��WYd}~qd}~wwdS)Nr2zchanged size during iteration)r�r�rrKrZ)r�functionr�r�r�r�rrr
�check_set_op_does_not_crashs���z2TestOperationsMutating.check_set_op_does_not_crash)r	r
rr�r�r�r�rrrr
r��sr�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �TestBinaryOpsMutatingcC�|�dd��dS)NcSs||kSrr�r<rirrr
r2�z=TestBinaryOpsMutating.test_eq_with_mutation.<locals>.<lambda>�r�rrrr
�test_eq_with_mutationr�z+TestBinaryOpsMutating.test_eq_with_mutationcCr�)NcSs||kSrrr�rrr
r2r�z=TestBinaryOpsMutating.test_ne_with_mutation.<locals>.<lambda>r�rrrr
�test_ne_with_mutationr�z+TestBinaryOpsMutating.test_ne_with_mutationcCr�)NcSs||kSrrr�rrr
r2r�z=TestBinaryOpsMutating.test_lt_with_mutation.<locals>.<lambda>r�rrrr
�test_lt_with_mutationr�z+TestBinaryOpsMutating.test_lt_with_mutationcCr�)NcSs||kSrrr�rrr
r2r�z=TestBinaryOpsMutating.test_le_with_mutation.<locals>.<lambda>r�rrrr
�test_le_with_mutationr�z+TestBinaryOpsMutating.test_le_with_mutationcCr�)NcSs||kSrrr�rrr
r2r�z=TestBinaryOpsMutating.test_gt_with_mutation.<locals>.<lambda>r�rrrr
�test_gt_with_mutationr�z+TestBinaryOpsMutating.test_gt_with_mutationcCr�)NcSs||kSrrr�rrr
r2 r�z=TestBinaryOpsMutating.test_ge_with_mutation.<locals>.<lambda>r�rrrr
�test_ge_with_mutationr�z+TestBinaryOpsMutating.test_ge_with_mutationcCr�)NcSs||@Srrr�rrr
r2#r�z>TestBinaryOpsMutating.test_and_with_mutation.<locals>.<lambda>r�rrrr
�test_and_with_mutation"r�z,TestBinaryOpsMutating.test_and_with_mutationcCr�)NcSs||BSrrr�rrr
r2&r�z=TestBinaryOpsMutating.test_or_with_mutation.<locals>.<lambda>r�rrrr
�test_or_with_mutation%r�z+TestBinaryOpsMutating.test_or_with_mutationcCr�)NcSs||Srrr�rrr
r2)r�z>TestBinaryOpsMutating.test_sub_with_mutation.<locals>.<lambda>r�rrrr
�test_sub_with_mutation(r�z,TestBinaryOpsMutating.test_sub_with_mutationcCr�)NcSs||ASrrr�rrr
r2,r�z>TestBinaryOpsMutating.test_xor_with_mutation.<locals>.<lambda>r�rrrr
�test_xor_with_mutation+r�z,TestBinaryOpsMutating.test_xor_with_mutationcC�dd�}|�|�dS)NcSs||M}dSrrr�rrr
rq/r�z8TestBinaryOpsMutating.test_iadd_with_mutation.<locals>.fr�r?rrr
�test_iadd_with_mutation.�z-TestBinaryOpsMutating.test_iadd_with_mutationcCr�)NcSs||O}dSrrr�rrr
rq4r�z7TestBinaryOpsMutating.test_ior_with_mutation.<locals>.fr�r?rrr
�test_ior_with_mutation3r�z,TestBinaryOpsMutating.test_ior_with_mutationcCr�)NcSs||8}dSrrr�rrr
rq9r�z8TestBinaryOpsMutating.test_isub_with_mutation.<locals>.fr�r?rrr
�test_isub_with_mutation8r�z-TestBinaryOpsMutating.test_isub_with_mutationcCr�)NcSs||N}dSrrr�rrr
rq>r�z8TestBinaryOpsMutating.test_ixor_with_mutation.<locals>.fr�r?rrr
�test_ixor_with_mutation=r�z-TestBinaryOpsMutating.test_ixor_with_mutationcCs:dd�}dd�}dd�}|�|�|�|�|�|�dS)NcSs|D]}q|D]}qdSrr�r<rir_rrrr
�f1C�
�z>TestBinaryOpsMutating.test_iteration_with_mutation.<locals>.f1cSs|D]}q|D]}qdSrr)r<rirr_rrr
�f2Hr�z>TestBinaryOpsMutating.test_iteration_with_mutation.<locals>.f2cSst||�D]\}}qdSr)�zipr�rrr
�f3Ms�z>TestBinaryOpsMutating.test_iteration_with_mutation.<locals>.f3r�)rr�r�r�rrr
�test_iteration_with_mutationBs

z2TestBinaryOpsMutating.test_iteration_with_mutationN)r	r
rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r�s r�c@�eZdZeZeZdS)�TestBinaryOpsMutating_Set_SetN�r	r
rr?r�r�rrrr
r�Ur+r�c@r�)�'TestBinaryOpsMutating_Subclass_SubclassN�r	r
rr(r�r�rrrr
r�Yr+r�c@r))�"TestBinaryOpsMutating_Set_SubclassN�r	r
rr?r�r(r�rrrr
r�]r+r�c@r))�"TestBinaryOpsMutating_Subclass_SetN�r	r
rr(r�r?r�rrrr
r�ar+r�c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TestMethodsMutatingcC�|�tj�dSr)r�r?r�rrrr
�test_issubset_with_mutationhr�z/TestMethodsMutating.test_issubset_with_mutationcCr�r)r�r?r�rrrr
�test_issuperset_with_mutationkr�z1TestMethodsMutating.test_issuperset_with_mutationcCr�r)r�r?rjrrrr
�test_intersection_with_mutationnr�z3TestMethodsMutating.test_intersection_with_mutationcCr�r)r�r?rWrrrr
�test_union_with_mutationqr�z,TestMethodsMutating.test_union_with_mutationcCr�r)r�r?rwrrrr
�test_difference_with_mutationtr�z1TestMethodsMutating.test_difference_with_mutationcCr�r)r�r?r|rrrr
�'test_symmetric_difference_with_mutationwr�z;TestMethodsMutating.test_symmetric_difference_with_mutationcCr�r)r�r?rsrrrr
�test_isdisjoint_with_mutationzr�z1TestMethodsMutating.test_isdisjoint_with_mutationcCr�r)r�r?r
rrrr
�$test_difference_update_with_mutation}r�z8TestMethodsMutating.test_difference_update_with_mutationcCr�r)r�r?rrrrr
�&test_intersection_update_with_mutation�r�z:TestMethodsMutating.test_intersection_update_with_mutationcCr�r)r�r?r�rrrr
�.test_symmetric_difference_update_with_mutation�r�zBTestMethodsMutating.test_symmetric_difference_update_with_mutationcCr�r)r�r?rrrrr
�test_update_with_mutation�r�z-TestMethodsMutating.test_update_with_mutationN)r	r
rr�r�r�r�r�r�r�r�r�r�r�rrrr
r�fsr�c@r�)�TestMethodsMutating_Set_SetNr�rrrr
r��r+r�c@r�)�%TestMethodsMutating_Subclass_SubclassNr�rrrr
r��r+r�c@r))� TestMethodsMutating_Set_SubclassNr�rrrr
r��r+r�c@r))� TestMethodsMutating_Subclass_SetNr�rrrr
r��r+r�c@seZdZeZejZdS)�TestMethodsMutating_Set_DictN)r	r
rr?r�r6r7r�rrrr
r��s
r�c@r))�TestMethodsMutating_Set_ListN)r	r
rr?r�r[r�rrrr
r��r+r�ccs\�	t|�}ztt|�g�}t|�D]
}|V||BVqWdSty-t�VYdSwr)r�rJr�rJr�)�Ur_r�rrr
rJ�s���rJcs2	dd�t|�D��t�fdd�tt|��D��S)NcSsg|]}t|g��qSr�rJ)r�r_rrr
r5�szcube.<locals>.<listcomp>cs&g|]��t�fdd��D��f�qS)csg|]}�|A�qSrr)r�r5r�rr
r5�r6z#cube.<locals>.<listcomp>.<listcomp>r�)r��Z
singletonsr�r
r5�s�)r�r6rJr4rr�r
�cube�s

�r�csj	i}|D]-�|�D]&���fdd�|�D�}��fdd�|�D�}t||�|t��g�<qq|S)Ncs g|]}|�krt�|g��qSrr��r�rm�r_rrr
r5�� zlinegraph.<locals>.<listcomp>cs g|]}|�krt�|g��qSrr�r�r�rr
r5�r�r�)rkr�Znx�nyrr�r
�	linegraph�s�r�c
Cs�	t�}|��D]f\}}|D]_}||D]X}||krq|||vr,|�t|||g��q||D];}||kr7q0|||vrI|�t||||g��q0||D]}||ksW||krXqM|||vrj|�t|||||g��qMq0qqq|Sr)r?�itemsr�rJ)rkrqr��edgesr�Zv3Zv4Zv5rrr
�faces�s2�����r�c@r)�
TestGraphscCs�td�}t|�}|�t|�d�|��D]
}|�t|�d�qtdd�|��D��}|�||�t|�}|�t|�d�|D]
}|�t|�d�q>dS)Nr�r�cs��|]
}|D]}|VqqdSrr)r�r�r�rrr
r����z'TestGraphs.test_cube.<locals>.<genexpr>r�r�)r�r?rCrGr^r�)rr�Z	vertices1�edgeZ	vertices2Z	cubefaces�facerrr
�	test_cube�s�zTestGraphs.test_cubecCs�td�}t|�}|�t|�d�t|�}|��D]
}|�t|�d�qtdd�|��D��}|�||�t|�}t�t	�}|D]}|t|�d7<q?|�|dd�|�|dd�|D]}	|	}
|�t|
�d	�|
D]}|�
||�qlq^dS)
Nr��r�csr�rr)r�r�r�rrr
r��r�z0TestGraphs.test_cuboctahedron.<locals>.<genexpr>rr�r�r:)r�r�rCrGr?r^r�r��defaultdictr.rK)rr�Z
cuboctahedronZverticesr�Z
otherverticesZ	cubofacesZ	facesizesr�Zvertexr�Zcubevertrrr
�test_cuboctahedron�s*
��zTestGraphs.test_cuboctahedronN)r	r
rr�r�rrrr
r��sr��__main__)jr'�testrZtest.supportrr�r�r�r�r��randomrrr�r��collections.abcrH�	Exceptionrrrr"r.r(r0ZTestCaser�r?r(r*r,r/r1rJrPrQrmrUr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr&r)r*r,r-r.rKrPrQrRrSrTrVr[r\r^r_rarbrjrkror{rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rJr�r�r�r�r	�mainrrrr
�<module>s�<Ij


IVJ&t+
	
	)	)$G$
1�