asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T a bYh@sddlZddlmZddlZddlZddlZddlZddlZddlm Z m Z ddl Z ddl Z ddl Z ddlZGdddeZddZGdd d ZGd d d ZGd d d eZGdddZGdddeejZGdddeZGdddeZGdddeZGdddeZGdddeejZGdddeZ GdddeZ!eZ"Gd d!d!Z#Gd"d#d#e#ejZ$Gd$d%d%e#ejZ%Gd&d'd'e#ejZ&Gd(d)d)e#ejZ'Gd*d+d+e#ejZ(Gd,d-d-e#ejZ)Gd.d/d/e#ejZ*d0d1Z+d2d3Z,Gd4d5d5ejZ-Gd6d7d7ejZ.Gd8d9d9ejZ/Gd:d;d;ejZ0Gdd?d?Z2Gd@dAdAe2ejZ3GdBdCdCe2ejZ4GdDdEdEe2ejZ5GdFdGdGe2ejZ6GdHdIdIe2ejZ7GdJdKdKZ8GdLdMdMe8ejZ9GdNdOdOe8ejZ:GdPdQdQe8ejZ;GdRdSdSe8ejZGdXdYdYZ?GdZd[d[e?ejZ@Gd\d]d]e?ejZAGd^d_d_e?ejZBGd`dadae?ejZCGdbdcdce?ejZDGdddedeejZEdfdgZFGdhdidiZGGdjdkdkZHGdldmdmZIGdndodoZJGdpdqdqZKGdrdsdsZLGdtduduZMddvlmNZNdwdxZOGdydzdzejZPGd{d|d|ZQGd}d~d~ZRGdddejZSGdddZTGdddeTZUGdddeUejZVGdddeUejZWGdddeUejZXGdddeUejZYGdddeTZZGdddeZejZ[GdddeZejZ\GdddeZejZ]GdddeZejZ^GdddeZejZ_GdddeZejZ`ddZaddZbddZcddZdGdddejZeefdkregdS)N)support) randrangeshufflec@s eZdZdS)PassThruN__name__ __module__ __qualname__r r )/usr/local/lib/python3.9/test/test_set.pyrsrccstdVdSN)rr r r r check_pass_thrusrc@seZdZddZddZdS)BadCmpcCsdSr r selfr r r __hash__szBadCmp.__hash__cCstdSN) RuntimeErrorrotherr r r __eq__sz BadCmp.__eq__Nrrr rrr r r r rsrc@seZdZdZddZdS) ReprWrapperz*Used to test self-referential repr() callscCs t|jSr)reprvaluerr r r __repr__szReprWrapper.__repr__N)rrr __doc__rr r r r rsrc@s eZdZdZddZddZdS)HashCountingIntzBint-like object that counts the number of times __hash__ is calledcGs d|_dSNr hash_count)rargsr r r __init__"szHashCountingInt.__init__cCs|jd7_t|Sr )r!intrrr r r r$szHashCountingInt.__hash__N)rrr rr#rr r r r r src@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9S): TestJointOpscCs2d|_}d|_d|_|||_t||_dS)NZ simsalabimZ madagascarZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)word otherwordlettersthetypesdictfromkeysd)rr&r r r setUp+s   zTestJointOps.setUpcCs*|t|jgd|jttjdddS)Nr a) assertRaises TypeErrorr)setr#rr r r test_new_or_init2szTestJointOps.test_new_or_initcCsHt|j}t|j}||||t|jt|t|jggdSr) sortedr*r- assertEqualr2rr)rr3)ractualexpectedr r r test_uniquification6s    z TestJointOps.test_uniquificationcCs|t|jt|jdSr)r7lenr*r-rr r r test_len=szTestJointOps.test_lencCsb|jD]}|||jv||jvq|t|jjgg|t|jg}| ||j|dSr) r(r7r*r-r2r3 __contains__r) frozensetassertIn)rcr*r r r test_contains@s  zTestJointOps.test_containscCs|j|j}|jD]$}|||v||jvp4||jvq||j||j|t||j | t |jjt | t |jjggtttjtttfD]}||d|dtd||d|dtd||d|dtd||d|dtd ||d|d|d tdq|}||td g|td g|d d gdS) NabcbacdcabcdefgfeabcefgccbabcefabcefZfgr r/)r*unionr'r(r7r-r)r&typebasetyper2rrr3r4r>r+r,strlisttuple)rur@Cxr r r test_unionGs "    (zTestJointOps.test_unioncCsp|j|j}||jt|jB|||jt|jB|z|j|jBWnty`Yn 0|ddS)Nz(s|t did not screen-out general iterables)r*rKr'r7r4r>r3failrir r r test_orZs zTestJointOps.test_orcCs|j|j}|jD]$}|||v||jvo4||jvq||j||j|t||j | t |jjt t ttjtttfD]}||d|dt d||d|dt d||d|dt d||d|dt d||d|d |d t d q|d}|}|jtkrj|t|t|n|t|t|dS) NrBrCccrErGbcrIZcbcfZbagb)r* intersectionr'r(r7r-r)r&rLrMr2rrr4r>r+r,rNrOrPidassertNotEqual)rrWr@rRr*zr r r test_intersectiones" "    ( zTestJointOps.test_intersectionc Csdd}dD]n}||}dD]Z}tttjtttfD]B}||}||}|||}| ||| |dupr|duq4qq dS)NcSst|| S)z&Pure python equivalent of isdisjoint())r4r])s1s2r r r fzsz'TestJointOps.test_isdisjoint..f) rZr1abrHZababacrCrYrErGrITF) r)r4r>r+r,rNrOrP isdisjointr7 assertTrue) rrdZlargrbZrargrRrcr8r9r r r test_isdisjointys    zTestJointOps.test_isdisjointcCsp|j|j}||jt|j@|||jt|j@|z|j|j@Wnty`Yn 0|ddS)Nz(s&t did not screen-out general iterables)r*r]r'r7r4r>r3rUrVr r r test_ands zTestJointOps.test_andcCsf|j|j}|jD]$}|||v||jvo4||jvq||j||j|t||j | t |jjt | t |jjggtttjtttfD]}||d|dtd||d|dtd||d|dtd||d|dtd||dtd||d|d|d td qdS) NrBrCrerErHrGr1rIr\r@)r* differencer'r(r7r-r)r&rLrMr2rrr3r4r>r+r,rNrOrPrrWr@rRr r r test_differences "    zTestJointOps.test_differencecCsp|j|j}||jt|j|||jt|j|z|j|jWnty`Yn 0|ddS)Nz(s-t did not screen-out general iterables)r*rjr'r7r4r>r3rUrVr r r test_subs zTestJointOps.test_subcCs&|j|j}|jD]$}|||v||jv||jvAq||j||j|t||j | t |jjt | t |jjggtttjtttfD]}||d|dtd||d|dtd||d|dtd||d|dtd qdS) NrBrCabdrErFrGr1rIrJ)r*symmetric_differencer'r(r7r-r)r&rLrMr2rrr3r4r>r+r,rNrOrPrkr r r test_symmetric_differences "   z&TestJointOps.test_symmetric_differencecCsp|j|j}||jt|jA|||jt|jA|z|j|jAWnty`Yn 0|ddS)Nz(s^t did not screen-out general iterables)r*ror'r7r4r>r3rUrVr r r test_xors zTestJointOps.test_xorcCs|||jt|j||jt|j||j|jkd||jt|j||jt|j||j|jkddSNFT)r7r*r4r&r>r_r'rr r r test_equalitys zTestJointOps.test_equalitycCs,ttgd}||}|t|ddS)N)ZabcdefZbcdZbdcbZfedZfedccba)mapr>r)r7r;)rtr*r r r test_setOfFrozensetss z!TestJointOps.test_setOfFrozensetscCst|jgd\}}}|||k|||k|||k|||k|||k|||k|||k|||k|||k|tdd|tdd|tdd|tdddS)N)reZabcdedefr1rHZcbs)rur)rgZ assertFalser4issubset issuperset)rpqrr r r test_sub_and_superszTestJointOps.test_sub_and_supercCsttjdD]z}t|j|}t|}||j|d|j|ft|jtt fvrd|j_ t|j|}t|}||jj |j qdS)Nr %s != %s ) rangepickleHIGHEST_PROTOCOLdumpsr*loadsr7rLr4r>rS)rrWr{dupr r r test_picklings  zTestJointOps.test_picklingc CsttjdD]}t|j}||j}t||}t|}||t j j | |||t|}z t |}WntyYqYn0t||}t|}| |||||fqdSr )rrriterr*r)rrZassertIsInstance collectionsrHIteratorr7next StopIteration)rprotoZitorgdatar-itZdropr r r test_iterator_picklings          z#TestJointOps.test_iterator_picklingcs~Gfdddd}||g}t|}|t|t||D]}|}qH|t|t|||jd|jdS)Ncs*eZdZddZddZdfdd ZdS) z*TestJointOps.test_deepcopy..TracercSs ||_dSrr)rrr r r r#sz3TestJointOps.test_deepcopy..Tracer.__init__cSs|jSrrrr r r rsz3TestJointOps.test_deepcopy..Tracer.__hash__Ncs|jdSr r)rmemoTracerr r __deepcopy__ sz7TestJointOps.test_deepcopy..Tracer.__deepcopy__)N)rrr r#rrr rr r rsrrr )r)copydeepcopyr_r^r7r)rrvr*relemZnewtr rr test_deepcopys  zTestJointOps.test_deepcopycsNGdddtfddtdD}|D]}||_||_t|g|_q,dS)Nc@s eZdZdS)zTestJointOps.test_gc..ANrr r r r Asrc3s|] }VqdSrr .0rWrr r z'TestJointOps.test_gc..)r4rcyclesub)rr*rr rr test_gcs zTestJointOps.test_gccCsVGddd|j}|}t}|||||||||||dS)Nc@seZdZddZdS)z6TestJointOps.test_subclass_with_custom_hash..HcSstt|d@S)Ni)r$r^rr r r r!sz?TestJointOps.test_subclass_with_custom_hash..H.__hash__N)rrr rr r r r H sr)r)r4addr?removediscard)rrr*rdr r r test_subclass_with_custom_hashs    z+TestJointOps.test_subclass_with_custom_hashcCs||tg}|t|jttg|t|jtt|drx|t|jt|t|jt|t|jtdS)Nr) r)rr2rr=hasattrrrrrr*r r r test_badcmp+s zTestJointOps.test_badcmpcCsbt}||g}||_|jtkr4|t|dn*t|dd}|t|d||fdS)Nz {set(...)}(rz %s({%s(...)}))rr)rr4r7r partition)rwr*namer r r test_cyclical_repr6s  zTestJointOps.test_cyclical_reprc Cst}||g}||_ttjd}zN|t||ttjd}| | t |W|t tjn|t tj0dSNrr}) rr)ropenrTESTFNwriterNcloser7readrunlink)rrr*for r r test_cyclical_print@s   z TestJointOps.test_cyclical_printcCs:d}tttt|}|tdd|D|||}|tdd|D||||tdd|D|t |dr| ||tdd|D|tt |}|tdd|D|tt |}|td d|D|tt |d }|td d|D|||t|d dS) Nrcss|] }|jVqdSrr rrr r r rQrz.css|] }|jVqdSrr rr r r rSrcss|] }|jVqdSrr rr r r rUrsymmetric_difference_updatecss|] }|jVqdSrr rr r r rXrcss|] }|jVqdSrr rr r r rZrcss|] }|jVqdSrr rr r r r\r{css|] }|jVqdSrr rr r r r^r) r+r,rurrr7sumr)rjrrr4r>)rnr-r*Zd2Zd3r r r test_do_not_rehash_dict_keysNs"    z)TestJointOps.test_do_not_rehash_dict_keyscCsXGdddt}|}t|}t|dg}t||_~~t||duddS)Nc@s eZdZdS)z/TestJointOps.test_container_iterator..CNrr r r r rRcsrRr zCycle was not collected) objectweakrefrefr4rrSgcZcollectrg)rrRobjr containerr r r test_container_iteratoras   z$TestJointOps.test_container_iteratorcCst|t|jdSr)rZcheck_free_after_iteratingrr)rr r r test_free_after_iteratingmsz&TestJointOps.test_free_after_iteratingN)rrr r.r5r:r<rArTrXrarhrirlrmrprqrsrwr~rrrrrrrrrrrr r r r r%(s8          r%c@seZdZeZeZddZddZddZddZ d d Z d d Z d dZ ddZ ddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Ze e!ed3d4d5d6Z"d7S)8TestSetcCsj|}||j||t|j||j||t|j|t|j|d|t|jddS)Nr/r )r)r#r&r7r4r'r2r3rr r r test_initts  zTestSet.test_initcCs0|td}||}|t|t|dSNrtr)rr_r^rr*rvr r r test_constructor_identity}s z!TestSet.test_constructor_identitycCs$tgd}hd}|||dS)Nr r/rtr r/rtr4r7rr r r test_set_literals zTestSet.test_set_literalcCs4hd}|t|d|}|t|tdS)N>r r )r7r;poprLr$)rr*Z stored_valuer r r test_set_literal_insertion_ordersz(TestSet.test_set_literal_insertion_ordercs:gfdd}|d|d|dh}|gddS)Ncs|dSr)append)reventsr r recordsz9TestSet.test_set_literal_evaluation_order..recordr r/rtr)r7)rrr*r rr !test_set_literal_evaluation_orders z)TestSet.test_set_literal_evaluation_ordercCs|tt|jdSr)r2r3hashr*rr r r test_hashszTestSet.test_hashcCs0|j||jt|t|jddSr)r*clearr7r4r;rr r r test_clears zTestSet.test_clearcCsD|j}||j||t|jt||t||jdSr)r*rr7r_r^rLrMrrr r r test_copys zTestSet.test_copycCsT|jd|d|j|j}|jd||j||t|jjgdS)NQ)r*rr?rr7r2r3rr r r test_adds    zTestSet.test_addcCs|jd|d|j|t|jjd|t|jjg|t|jg}| ||j||||j|||j||t|jj||jdSNr1r) r*r assertNotInr2KeyErrorr3r)r>r&r?rr r r test_removes zTestSet.test_removec CsbdD]X}z|j|Wn:tyR}z"|jd}|||WYd}~qd}~00|qdS)N)rr r)r*rrr"r7rU)rv1ev2r r r test_remove_keyerror_unpackings "z&TestSet.test_remove_keyerror_unpackingc Cst|ddg}z|j|WnHtyf}z0||jd|ud||jdWYd}~nd}~00|dS)NrtrzKeyError should be {0}, not {1})r)r*rrrgr"formatrU)rkeyrr r r test_remove_keyerror_setsz TestSet.test_remove_keyerror_setcCs|jd|d|j|jd|t|jjg|t|jg}|||j||||j|||j||||jdSr) r*rrr2r3r)r>r&r?rr r r test_discards  zTestSet.test_discardcCs@tt|jD]}|j}|||jq|t|jjdSr)rr;r*rrr2r)rrWrr r r test_pops zTestSet.test_popc Cs(|j|j}||d|j|jD]}|||jq&|t|jjt|t |jjggdD]P\}}t t t j tttfD]4}|d}||||d||t |qqfdD]f}d}t t t j tttfD]J}|d}||||||d||t |t |Bt |BqqdS)N))rCrDrErF)rGrHrIrJrB)rCrErGrIZabcdaZahi)r*updater'r7r&r?r2rrr3r4r>r+r,rNrOrPr)rretvalr@r{r|rRr*r r r test_updates"    zTestSet.test_updatecCs8|jt|jO_|j|jD]}|||jq dSr)r*r4r'r&r?rr@r r r test_iorszTestSet.test_iorc Cs.|j|j}||d|j|jD]6}||jvrN||jvrN|||jq&|||jq&|t|jjt |t |jjggdD]\}}t t t jtttfD]}|d}||||d||t |d}||}d}||||||d||t dt |@t |@qqdS)N))rCr@)rErZ)rGr[)rIrZrBZcbc)r*intersection_updater'r7r&r?rr2rrr3r4r>r+r,rNrOrPr)) rrr@r{r|rRr*ssrvr r r test_intersection_updates$    z TestSet.test_intersection_updatecCs\|jt|jM_|j|jD]6}||jvrH||jvrH|||jq |||jq dSrr*r4r'r&r?rrr r r test_iand s zTestSet.test_iandcCsr|j|j}||d|j|jD]6}||jvrN||jvrN|||jq&|||jq&|t|jjt |t |jjgg|t |jj ggdD]\}}t t tjtttfD]}|d}||||d||t ||d}||||d|d}||d|||d|d}||d|d|||dqqdS)N))rCre)rErHrGr1)rIrHrBZ abcdefghihZabaZcdefghihrCZefghih)r*difference_updater'r7r&r?rr2rrr3rr4r>r+r,rNrOrPr)rr r r test_difference_updates.      zTestSet.test_difference_updatecCs\|jt|j8_|j|jD]6}||jvrH||jvrH|||jq |||jq dSrrrr r r test_isub0s zTestSet.test_isubcCs|j|j}||d|j|jD]6}||jv||jvArN|||jq&|||jq&|t|jjt |t |jjggdD]P\}}t t t jtttfD]4}|d}||||d||t |qqdS)N))rCrnrrrrB)r*rr'r7r&r?rr2rrr3r4r>r+r,rNrOrPr)rr r r test_symmetric_difference_update8s   z(TestSet.test_symmetric_difference_updatecCs\|jt|jN_|j|jD]6}||jv||jvArH|||jq |||jq dSrrrr r r test_ixorHs zTestSet.test_ixorcCst|j}||O}|||j||M}|||j||8}||||j}||N}|||dSr)r*rr7r))rrvr r r test_inplace_on_selfPs  zTestSet.test_inplace_on_selfcCsF|d}t|}|t|t|d}t|tt|dS)NZgallahad) r)rproxyr7rNr gc_collectr2ReferenceError)rr*r{r r r test_weakref\s   zTestSet.test_weakrefcCsGddd}hd}|}||k||j|}||k||j|}||k||j|}||k||jdS)Nc@s,eZdZddZddZddZddZd S) z5TestSet.test_rich_compare..TestRichSetComparecSs d|_dSNTF) gt_calledrZsome_setr r r __gt__fsz.TestRichSetCompare.__gt__cSs d|_dSr) lt_calledr r r r __lt__isz.TestRichSetCompare.__lt__cSs d|_dSr) ge_calledr r r r __ge__lsz.TestRichSetCompare.__ge__cSs d|_dSr) le_calledr r r r __le__osz.TestRichSetCompare.__le__N)rrr r r rrr r r r TestRichSetCompareesrr)rgr r rr)rrZmysetZmyobjr r r test_rich_compareds   zTestSet.test_rich_compare test_c_apiz*C API test only available in a debug buildcCs|tddSNT)r7r4rrr r r rszTestSet.test_c_apiN)#rrr r4r)rMrrrrrrrrrrrrrrrrrrrrrrrrrunittestZ skipUnlessrrr r r r rps>      $ rc@s eZdZdS) SetSubclassNrr r r r rsrc@seZdZeZeZdS)TestSetSubclassN)rrr rr)r4rMr r r r rsrc@seZdZgdfddZdS)SetSubclassWithKeywordArgsNcCst||dSr)r4r#)riterablenewargr r r r#sz#SetSubclassWithKeywordArgs.__init__)rrr r#r r r r rsrc@seZdZddZdS)TestSetSubclassWithKeywordArgscCstdddS)z=SF bug #1486663 -- this used to erroneously raise a TypeErrorr )rN)rrr r r test_keywords_in_subclasssz8TestSetSubclassWithKeywordArgs.test_keywords_in_subclassN)rrr rr r r r rsrc@sTeZdZeZeZddZddZddZddZ d d Z d d Z d dZ ddZ dS) TestFrozenSetcCs.||j}||j||t|jdSr)r)r&r#r'r7r4rr r r rs  zTestFrozenSet.test_initc Csnt}ttgtdtdttgtdtdttdttt||g }|tttt|ddS)Nr rZrr )r>rr7r;r4rur^)rrdefsr r r test_singleton_empty_frozensetsz,TestFrozenSet.test_singleton_empty_frozensetcCs0|td}||}|t|t|dSr)r)rr7r^rr r r rs z'TestFrozenSet.test_constructor_identitycs~|t|dt|ddfddtD}t}tdD] }t||t||qH|t|ddS)NZabcdebZebecdadcsg|] }tqSr rrrr r rz+TestFrozenSet.test_hash..r )r7rr)rr4rrr;)rseqresultsrWr r#r rs  zTestFrozenSet.test_hashcCs$|j}|t|jt|dSr)r*rr7r^rr r r rs zTestFrozenSet.test_copycCsrttdtddg}||}|t|}||||t|t|i}d||<|||ddS)NrZabcdefgZapple*)rOrr)reversedr7r_r^)rr&Zkey1Zkey2r-r r r test_frozen_as_dictkeys  z$TestFrozenSet.test_frozen_as_dictkeycCs"|d}|t|t|dS)NZabcdcda)r)r7rrrdr r r test_hash_cachings zTestFrozenSet.test_hash_cachingc sd}t}|j}ddt|D}td|D]"|ttfdd|Dq.|t|d|dd}dd }td D]V}d|}|d t|fD]8}tfd d tt|||D} |d| |qq~dS)N cSsg|]}|dd|>fqSrr rr r r r$rz9TestFrozenSet.test_hash_effectiveness..r/csg|]\}}|@r|qSr r )rrmrWr r r$rcSs8tg}t|dD]}t|}||q|d|Sr )r>rr)rnumsrWnumr r r zf_ranges  z7TestFrozenSet.test_hash_effectiveness..zf_rangecss2tt|dD]}ttt||EdHqdSr )rr;rur> itertools combinations)r*rWr r r powersetsz7TestFrozenSet.test_hash_effectiveness..powersetr csh|] }|@qSr r )rh)maskr r rz8TestFrozenSet.test_hash_effectiveness..r) r4rrrr>r7r;ruZ assertGreater) rrZ hashvaluesZ addhashvalueZ elemmasksr2r5rvr0rQr )rWr8r test_hash_effectivenesss   $z%TestFrozenSet.test_hash_effectivenessN)rrr r>r)rMrr rrrr*r,r:r r r r rs   rc@s eZdZdS)FrozenSetSubclassNrr r r r r;sr;c@s4eZdZeZeZddZddZddZ ddZ d S) TestFrozenSetSubclasscCs0|td}||}|t|t|dSrrrr r r rs z/TestFrozenSetSubclass.test_constructor_identitycCs$|j}|t|jt|dSr)r*rr_r^rr r r rs zTestFrozenSetSubclass.test_copycCs"|}||}|||dSr)r)r7rr r r test_nested_empty_constructors z3TestFrozenSetSubclass.test_nested_empty_constructorcCs|j}t}|}||g|d|d||g|d|d|td|||t||||||g}|tttt|t|dS)Nr rZr)r)r>rr7r;r4rur^)rZ FrozensetrdFrr r r r sz4TestFrozenSetSubclass.test_singleton_empty_frozensetN) rrr r;r)r>rMrrr=r r r r r r<s r<c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1S)2 TestBasicOpscCs"|jdur|t|j|jdSr)rr7r4rr r r test_reprs zTestBasicOps.test_reprcCslt|j}||d||d|ddd}|dd|jD}||||dS)N{}r z, cSsg|] }t|qSr )r)rrr r r r$#rz:TestBasicOps.check_repr_against_values..) rr4rg startswithendswithsplitsortvaluesr7)rtextresultZsorted_repr_valuesr r r check_repr_against_valuess z&TestBasicOps.check_repr_against_valuesc Cszz^ttjd}|t|j|ttjd}||t |jW|t tjn|t tj0dSr) rrrrrNr4rr7rrr)rrr r r test_print's  zTestBasicOps.test_printcCs|t|j|jdSr)r7r;r4lengthrr r r test_length2szTestBasicOps.test_lengthcCs||j|jdSrr7r4rr r r test_self_equality5szTestBasicOps.test_self_equalitycCs||j|jdSr)r7r4rrr r r test_equivalent_equality8sz%TestBasicOps.test_equivalent_equalitycCs||j|jdSr)r7r4rrrr r r r;szTestBasicOps.test_copycCs|j|jB}|||jdSrr4r7rrrJr r r test_self_union>s zTestBasicOps.test_self_unioncCs|jtB}|||jdSrr4 empty_setr7rrSr r r test_empty_unionBs zTestBasicOps.test_empty_unioncCst|jB}|||jdSr)rVr4r7rrSr r r test_union_emptyFs zTestBasicOps.test_union_emptycCs|j|j@}|||jdSrrRrSr r r test_self_intersectionJs z#TestBasicOps.test_self_intersectioncCs|jt@}||tdSrr4rVr7rSr r r test_empty_intersectionNs z$TestBasicOps.test_empty_intersectioncCst|j@}||tdSrrVr4r7rSr r r test_intersection_emptyRs z$TestBasicOps.test_intersection_emptycCs"|j|j}|||j dSrr4rfr7rSr r r test_self_isdisjointVsz!TestBasicOps.test_self_isdisjointcCs|jt}||ddSr)r4rfrVr7rSr r r test_empty_isdisjointZs z"TestBasicOps.test_empty_isdisjointcCst|j}||ddSr)rVrfr4r7rSr r r test_isdisjoint_empty^s z"TestBasicOps.test_isdisjoint_emptycCs|j|jA}||tdSrr4r7rVrSr r r test_self_symmetric_differencebs z+TestBasicOps.test_self_symmetric_differencecCs|jtA}|||jdSrrZrSr r r test_empty_symmetric_differencefs z,TestBasicOps.test_empty_symmetric_differencecCs|j|j}||tdSrrbrSr r r test_self_differencejs z!TestBasicOps.test_self_differencecCs|jt}|||jdSrrUrSr r r test_empty_differencens z"TestBasicOps.test_empty_differencecCst|j}||tdSrr\rSr r r test_empty_difference_revrs z&TestBasicOps.test_empty_difference_revcCs>|jD]}|||jqt|j}||t|jdSr)r4r?rHrr7__length_hint__r;)rvZsetiterr r r test_iterationvs  zTestBasicOps.test_iterationcCsJttjdD]6}t|j|}t|}||j|d|j|fqdS)Nr r)rrrrr4rr7)rrr{rr r r r|s    zTestBasicOps.test_picklingcCsp|ttdWdn1s,0Y|ttdWdn1sb0YdS)Nr)r2r3r4rjrrr r r test_issue_37219s * zTestBasicOps.test_issue_37219N)rrr r@rKrLrNrPrQrrTrWrXrYr[r]r_r`rarcrdrerfrgrjrrkr r r r r?s0  r?c@seZdZddZdS)TestBasicOpsEmptycCs4d|_g|_t|j|_t|j|_d|_d|_dS)Nz empty setrzset()caserHr4rrMrrr r r r.s   zTestBasicOpsEmpty.setUpNrrr r.r r r r rlsrlc@s$eZdZddZddZddZdS)TestBasicOpsSingletoncCs6d|_dg|_t|j|_t|j|_d|_d|_dS)Nzunit set (number)rtr z{3}rmrr r r r.s   zTestBasicOpsSingleton.setUpcCs|d|jdSrr?r4rr r r test_inszTestBasicOpsSingleton.test_incCs|d|jdSNr/rr4rr r r test_not_insz!TestBasicOpsSingleton.test_not_inNrrr r.rrrur r r r rpsrpc@s$eZdZddZddZddZdS)TestBasicOpsTuplecCs6d|_dg|_t|j|_t|j|_d|_d|_dS)Nzunit set (tuple)rzeror z {(0, 'zero')}rmrr r r r.s   zTestBasicOpsTuple.setUpcCs|d|jdS)Nrxrqrr r r rrszTestBasicOpsTuple.test_incCs|d|jdS)N rtrr r r ruszTestBasicOpsTuple.test_not_inNrvr r r r rwsrwc@seZdZddZdS)TestBasicOpsTriplecCs<d|_ddtjg|_t|j|_t|j|_d|_d|_dS)Nz triple setrryrt)rnoperatorrrHr4rrMrrr r r r.s   zTestBasicOpsTriple.setUpNror r r r r{sr{c@seZdZddZddZdS)TestBasicOpsStringcCs2d|_gd|_t|j|_t|j|_d|_dS)Nz string setr1r\r@rtrnrHr4rrMrr r r r.s    zTestBasicOpsString.setUpcCs |dSrrKrr r r r@szTestBasicOpsString.test_reprNrrr r.r@r r r r r}sr}c@seZdZddZddZdS)TestBasicOpsBytescCs2d|_gd|_t|j|_t|j|_d|_dS)Nz bytes set)abcrtrrr r r r.s    zTestBasicOpsBytes.setUpcCs |dSrrrr r r r@szTestBasicOpsBytes.test_reprNrr r r r rsrc@s$eZdZddZddZddZdS)TestBasicOpsMixedStringBytescCsRt|_|jtdtd|_gd|_t |j|_ t |j|_ d|_ dS)Nignorezstring and bytes set)r1r\rrr) rZcheck_warnings_warning_filters __enter__warnings simplefilter BytesWarningrnrHr4rrMrr r r r.s      z"TestBasicOpsMixedStringBytes.setUpcCs|jddddSr)r__exit__rr r r tearDownsz%TestBasicOpsMixedStringBytes.tearDowncCs |dSrrrr r r r@sz&TestBasicOpsMixedStringBytes.test_reprN)rrr r.rr@r r r r rs rccstdVdSr)r3r r r r baditersrccs dVdSrr r r r r gooditersrc@s(eZdZdZddZddZddZdS) TestExceptionPropagationz?SF 628246: Set constructor should not trap iterator TypeErrorscCs|tttdSr)r2r3r4rrr r r test_instanceWithExceptionsz3TestExceptionPropagation.test_instanceWithExceptioncCsFtgdtdtddddttdtdttdS)Nrr r/rt)ZoneZtwoZthreerH)r4rrrr r r test_instancesWithoutExceptions   z7TestExceptionPropagation.test_instancesWithoutExceptioncCsHtgd}z|D]}|dgqWnty8Yn 0|ddS)Nrrz0no exception when changing size during iteration)r4rrrU)rr*rWr r r test_changingSizeWhileIteratings  z8TestExceptionPropagation.test_changingSizeWhileIteratingN)rrr rrrrr r r r rs rc@seZdZddZdS) TestSetOfSetscCs\tdg}t|g}|}|t|t||||||t||dSr )r>r4rr7rLrrr)rinnerZouterelementr r r test_constructors    zTestSetOfSets.test_constructorN)rrr rr r r r rsrc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%S)& TestBinaryOpscCstd|_dSNr/rr4rr r r r. szTestBinaryOps.setUpcCs||jtdddddS)Nr rtrrOrr r r test_eq#szTestBinaryOps.test_eqcCs$|jtdgB}||tddSNr/rrrSr r r test_union_subset&szTestBinaryOps.test_union_subsetcCs*|jtgdB}||tgddSNr/rrrrSr r r test_union_superset*sz!TestBinaryOps.test_union_supersetcCs*|jtgdB}||tgddSNrtrr)r/rtrrrrrSr r r test_union_overlap.sz TestBinaryOps.test_union_overlapcCs(|jtdgB}||tgddSNrrrrSr r r test_union_non_overlap2sz$TestBinaryOps.test_union_non_overlapcCs"|jtd@}||tddSNr/rrrSr r r test_intersection_subset6sz&TestBinaryOps.test_intersection_subsetcCs*|jtgd@}||tgddSNrrrrSr r r test_intersection_superset:sz(TestBinaryOps.test_intersection_supersetcCs(|jtgd@}||tdgdSNrrrrSr r r test_intersection_overlap>sz'TestBinaryOps.test_intersection_overlapcCs |jtdg@}||tdSNrrbrSr r r test_intersection_non_overlapBsz+TestBinaryOps.test_intersection_non_overlapcCs |jtd}||ddS)NrFr^rSr r r test_isdisjoint_subsetFsz$TestBinaryOps.test_isdisjoint_subsetcCs$|jtgd}||ddS)NrFr^rSr r r test_isdisjoint_supersetJsz&TestBinaryOps.test_isdisjoint_supersetcCs$|jtgd}||ddS)NrFr^rSr r r test_isdisjoint_overlapNsz%TestBinaryOps.test_isdisjoint_overlapcCs"|jtdg}||ddS)NrTr^rSr r r test_isdisjoint_non_overlapRsz)TestBinaryOps.test_isdisjoint_non_overlapcCs$|jtdA}||tdgdSNrrrrSr r r test_sym_difference_subsetVsz(TestBinaryOps.test_sym_difference_subsetcCs$|jtdA}||tdgdSNrrrrSr r r test_sym_difference_supersetZsz*TestBinaryOps.test_sym_difference_supersetcCs&|jtdA}||tgddSNr)r/rtrrrrSr r r test_sym_difference_overlap^sz)TestBinaryOps.test_sym_difference_overlapcCs(|jtdgA}||tgddSrrrSr r r test_sym_difference_non_overlapbsz-TestBinaryOps.test_sym_difference_non_overlapN)rrr r.rrrrrrrrrrrrrrrrrr r r r rs$rc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+S), TestUpdateOpscCstd|_dSrrrr r r r.iszTestUpdateOps.setUpcCs*|jtdgO_||jtddSrrrr r r rlszTestUpdateOps.test_union_subsetcCs0|jtgdO_||jtgddSrrrr r r rpsz!TestUpdateOps.test_union_supersetcCs0|jtgdO_||jtgddSrrrr r r rtsz TestUpdateOps.test_union_overlapcCs.|jtdgO_||jtgddSrrrr r r rxsz$TestUpdateOps.test_union_non_overlapcCs.|jtgd||jtgddSr)r4rr7rr r r test_union_method_call|sz$TestUpdateOps.test_union_method_callcCs(|jtdM_||jtddSrrrr r r rsz&TestUpdateOps.test_intersection_subsetcCs0|jtgdM_||jtgddSrrrr r r rsz(TestUpdateOps.test_intersection_supersetcCs.|jtgdM_||jtdgdSrrrr r r rsz'TestUpdateOps.test_intersection_overlapcCs&|jtdgM_||jtdSrrbrr r r rsz+TestUpdateOps.test_intersection_non_overlapcCs,|jtgd||jtdgdSr)r4rr7rr r r test_intersection_method_callsz+TestUpdateOps.test_intersection_method_callcCs*|jtdN_||jtdgdSrrrr r r rsz(TestUpdateOps.test_sym_difference_subsetcCs*|jtdN_||jtdgdSrrrr r r rsz*TestUpdateOps.test_sym_difference_supersetcCs,|jtdN_||jtgddSrrrr r r rsz)TestUpdateOps.test_sym_difference_overlapcCs.|jtdgN_||jtgddSrrrr r r rsz-TestUpdateOps.test_sym_difference_non_overlapcCs.|jtgd||jtgddSr)r4rr7rr r r test_sym_difference_method_callsz-TestUpdateOps.test_sym_difference_method_callcCs*|jtd8_||jtdgdSrrrr r r test_difference_subsetsz$TestUpdateOps.test_difference_subsetcCs(|jtd8_||jtgdSrrrr r r test_difference_supersetsz&TestUpdateOps.test_difference_supersetcCs,|jtd8_||jtddgdSNrr/rrrr r r test_difference_overlapsz%TestUpdateOps.test_difference_overlapcCs.|jtdg8_||jtgddS)Nrrrrr r r test_difference_non_overlapsz)TestUpdateOps.test_difference_non_overlapcCs.|jtgd||jtddgdSr)r4rr7rr r r test_difference_method_callsz)TestUpdateOps.test_difference_method_callN)rrr r.rrrrrrrrrrrrrrrrrrrrr r r r rhs*rc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS) TestMutatecCsgd|_t|j|_dS)Nr~)rHr4rr r r r.s zTestMutate.setUpcCs"|jd||jtddS)Nr@rHr4rr7rr r r test_add_presents zTestMutate.test_add_presentcCs"|jd||jtddS)Nr-rDrrr r r test_add_absents zTestMutate.test_add_absentcCsJt}d}|jD]&}|||d7}|t||q|||jdS)Nrr )r4rHrr7r;)rtmp expected_lenrir r r test_add_until_fulls  zTestMutate.test_add_until_fullcCs"|jd||jtddS)Nr\Zac)r4rr7rr r r test_remove_presents zTestMutate.test_remove_presentcCs2z|jd|dWnty,Yn0dS)Nr-z7Removing missing element should have raised LookupError)r4rrU LookupErrorrr r r test_remove_absents   zTestMutate.test_remove_absentcCs@t|j}|jD]*}|j||d8}|t|j|qdSr )r;r4rHrr7)rrrir r r test_remove_until_emptys    z"TestMutate.test_remove_until_emptycCs"|jd||jtddS)Nr@rer4rr7rr r r test_discard_presents zTestMutate.test_discard_presentcCs"|jd||jtddS)Nr-rHrrr r r test_discard_absents zTestMutate.test_discard_absentcCs |j|t|jddSr)r4rr7r;rr r r rs zTestMutate.test_clearcCsLi}|jrd||j<q|t|t|j|jD]}|||q6dSr)r4rr7r;rHr?)rZpoppedrir r r rs  zTestMutate.test_popcCs$|jd||jt|jdS)Nr r4rr7rHrr r r test_update_empty_tuples z"TestMutate.test_update_empty_tuplecCs$|jd||jt|jdS)Nr0rrr r r test_update_unit_tuple_overlaps z)TestMutate.test_update_unit_tuple_overlapcCs*|jd||jt|jdgdS)N)r1r`r`rrr r r "test_update_unit_tuple_non_overlaps z-TestMutate.test_update_unit_tuple_non_overlapN)rrr r.rrrrrrrrrrrrrr r r r rs rc@s0eZdZdddZdddddd d Zd d Zd S) TestSubsetsryrz)<=>===!=>s rc@s*eZdZedgZeddgZdZdZdS)TestSubsetPartialr r/z&one a non-empty proper subset of otherrNrr r r r rFs  rc@s(eZdZedgZedgZdZdZdS)TestSubsetNonOverlapr r/zneither empty, neither containsrNrr r r r rNs  rc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)TestOnlySetsInBinaryOpscCsT||j|jkd||j|jkd||j|jkd||j|jkddSrr)r7rr4rr r r test_eq_neXsz"TestOnlySetsInBinaryOps.test_eq_necstfddtfddtfddtfddtfddtfddtfddtfd ddS) Ncs jjkSrr4rr rr r `rz:TestOnlySetsInBinaryOps.test_ge_gt_le_lt..cs jjkSrrr rr r rarcs jjkSrrr rr r rbrcs jjkSrrr rr r rcrcs jjkSrrr4r rr r rercs jjkSrrr rr r rfrcs jjkSrrr rr r rgrcs jjkSrrr rr r rhr)r2r3rr rr test_ge_gt_le_lt_sz(TestOnlySetsInBinaryOps.test_ge_gt_le_ltcCs6z|j|jO_Wnty&Yn 0|ddSNzexpected TypeErrorr4rr3rUrr r r test_update_operatorjs  z,TestOnlySetsInBinaryOps.test_update_operatorcCs.|jr|j|jn|t|jj|jdSr)otherIsIterabler4rrr2r3rr r r rrsz#TestOnlySetsInBinaryOps.test_updatecsVtfddtfddjr>jjntjjjdS)Ncs jjBSrrr rr r ryrz4TestOnlySetsInBinaryOps.test_union..cs jjBSrrr rr r rzr)r2r3rr4rKrrr rr rTxs z"TestOnlySetsInBinaryOps.test_unioncCs6z|j|jM_Wnty&Yn 0|ddSrrrr r r !test_intersection_update_operators  z9TestOnlySetsInBinaryOps.test_intersection_update_operatorcCs.|jr|j|jn|t|jj|jdSr)rr4rrr2r3rr r r rs z0TestOnlySetsInBinaryOps.test_intersection_updatecsVtfddtfddjr>jjntjjjdS)Ncs jj@Srrr rr r rrz;TestOnlySetsInBinaryOps.test_intersection..cs jj@Srrr rr r rr)r2r3rr4r]rrr rr ras z)TestOnlySetsInBinaryOps.test_intersectioncCs6z|j|jN_Wnty&Yn 0|ddSrrrr r r #test_sym_difference_update_operators  z;TestOnlySetsInBinaryOps.test_sym_difference_update_operatorcCs.|jr|j|jn|t|jj|jdSr)rr4rrr2r3rr r r test_sym_difference_updates z2TestOnlySetsInBinaryOps.test_sym_difference_updatecsVtfddtfddjr>jjntjjjdS)Ncs jjASrrr rr r rrz=TestOnlySetsInBinaryOps.test_sym_difference..cs jjASrrr rr r rr)r2r3rr4rorrr rr test_sym_differences z+TestOnlySetsInBinaryOps.test_sym_differencecCs6z|j|j8_Wnty&Yn 0|ddSrrrr r r test_difference_update_operators  z7TestOnlySetsInBinaryOps.test_difference_update_operatorcCs.|jr|j|jn|t|jj|jdSr)rr4rrr2r3rr r r rs z.TestOnlySetsInBinaryOps.test_difference_updatecsVtfddtfddjr>jjntjjjdS)Ncs jjSrrr rr r rrz9TestOnlySetsInBinaryOps.test_difference..cs jjSrrr rr r rr)r2r3rr4rjrrr rr rls z'TestOnlySetsInBinaryOps.test_differenceN)rrr rrrrrTrrrarrrrrrlr r r r rVs rc@seZdZddZdS)TestOnlySetsNumericcCstd|_d|_d|_dS)NrFr4rrrr r r r.s zTestOnlySetsNumeric.setUpNror r r r rsrc@seZdZddZdS)TestOnlySetsDictcCs td|_ddd|_d|_dS)Nrr/r)r rtTrrr r r r.s  zTestOnlySetsDict.setUpNror r r r rsrc@seZdZddZdS)TestOnlySetsOperatorcCstd|_tj|_d|_dS)NrF)r4r|rrrrr r r r.s zTestOnlySetsOperator.setUpNror r r r rsrc@seZdZddZdS)TestOnlySetsTuplecCstd|_d|_d|_dS)NrrTrrr r r r.s zTestOnlySetsTuple.setUpNror r r r r sr c@seZdZddZdS)TestOnlySetsStringcCstd|_d|_d|_dS)NrrHTrrr r r r.s zTestOnlySetsString.setUpNror r r r r sr c@seZdZddZdS)TestOnlySetsGeneratorcCs$dd}td|_||_d|_dS)NcsstdddD] }|Vq dS)Nrrr/)rr/r r r gensz(TestOnlySetsGenerator.setUp..genrTr)rr r r r r.s zTestOnlySetsGenerator.setUpNror r r r r sr c@seZdZddZddZdS) TestCopyingcCsd|j}t|td}t|jtd}|t|t|tt|D]}|||||uqDdSNr)r4rr6rr7r;rrgrrZdup_listZset_listrWr r r rs   zTestCopying.test_copycCsdt|j}t|td}t|jtd}|t|t|tt|D]}|||||qFdSr)rrr4r6rr7r;rrr r r test_deep_copys   zTestCopying.test_deep_copyN)rrr rrr r r r r sr c@seZdZddZdS)TestCopyingEmptycCs t|_dSrrrr r r r.szTestCopyingEmpty.setUpNror r r r rsrc@seZdZddZdS)TestCopyingSingletoncCstdg|_dS)NZhellorrr r r r.szTestCopyingSingleton.setUpNror r r r rsrc@seZdZddZdS)TestCopyingTriplecCstgd|_dS)N)ryrNrrr r r r.szTestCopyingTriple.setUpNror r r r rsrc@seZdZddZdS)TestCopyingTuplecCstdg|_dS)Nr r/rrr r r r.%szTestCopyingTuple.setUpNror r r r r$src@seZdZddZdS)TestCopyingNestedcCstdg|_dS)N)r)rtrrrr r r r.+szTestCopyingNested.setUpNror r r r r*src@s4eZdZddZddZddZddZd d Zd S) TestIdentitiescCstd|_td|_dS)NZ abracadabraZalacazam)r4r1r\rr r r r.1s zTestIdentities.setUpcCs|j|j}}||||k||||k|||@|k|||@|k|||B|k|||B|k|||A||BkdSr)r1r\rgrr1r\r r r test_binopsVsSubsets5sz#TestIdentities.test_binopsVsSubsetscCsj|j|j}}|||@||@|||B||B|||A||A||krf|||||dSr)r1r\r7r_rr r r test_commutativity?s z!TestIdentities.test_commutativitycCs|j|j}}|||||@B||B||B|||@||AB||B||||B||B||||B||B|||||@B||||||@B||||||B||AdSr)r1r\r7rr r r test_summationsGs$zTestIdentities.test_summationscCsZ|j|jt}}}||||@|||||@||||@||A@|dSr)r1r\r4r7)rr1r\ryr r r test_exclusionRszTestIdentities.test_exclusionN)rrr r.rrrrr r r r r0s   rccs|D] }|VqdS)zRegular generatorNr seqnrWr r r R[sr c@s eZdZdZddZddZdS)GzSequence using __getitem__cCs ||_dSrrrrr r r r#bsz G.__init__cCs |j|Srr"rVr r r __getitem__dsz G.__getitem__N)rrr rr#r$r r r r r!`sr!c@s(eZdZdZddZddZddZdS) Iz Sequence using iterator protocolcCs||_d|_dSrrr#r r r r#isz I.__init__cCs|Srr rr r r __iter__lsz I.__iter__cCs2|jt|jkrt|j|j}|jd7_|Sr rWr;rrrrir r r __next__ns z I.__next__Nrrr rr#r&r)r r r r r%gsr%c@s eZdZdZddZddZdS)Igz9Sequence using iterator protocol defined with a generatorcCs||_d|_dSrrr#r r r r#vsz Ig.__init__ccs|jD] }|VqdSrr")rvalr r r r&ys z Ig.__iter__Nrrr rr#r&r r r r r+tsr+c@s eZdZdZddZddZdS)Xz Missing __getitem__ and __iter__cCs||_d|_dSrrr#r r r r#sz X.__init__cCs2|jt|jkrt|j|j}|jd7_|Sr r'r(r r r r)s z X.__next__N)rrr rr#r)r r r r r.}sr.c@s eZdZdZddZddZdS)NzIterator missing __next__()cCs||_d|_dSrrr#r r r r#sz N.__init__cCs|Srr rr r r r&sz N.__iter__Nr-r r r r r/sr/c@s(eZdZdZddZddZddZdS) EzTest propagation of exceptionscCs||_d|_dSrrr#r r r r#sz E.__init__cCs|Srr rr r r r&sz E.__iter__cCs dddS)Nrtrr rr r r r)sz E.__next__Nr*r r r r r0sr0c@s(eZdZdZddZddZddZdS) SzTest immediate stopcCsdSrr r#r r r r#sz S.__init__cCs|Srr rr r r r&sz S.__iter__cCstdSr)rrr r r r)sz S.__next__Nr*r r r r r1sr1)chaincCsttddttt|S)z Test multiple tiers of iteratorscSs|Srr rSr r r rrzL..)r2rur r+r!r"r r r Lsr4c@s$eZdZddZddZddZdS)TestVariousIteratorArgsc CsttfD]}ddtddtdddfD]x}ttttttfD],}| t |||t dt ||t dq:| t |t|| t |t|| t|t|q&qdS) N123rZrZdog333333?rr)r4r>rr!r%r+r1r4r r7r6rr2r3r.r/ZeroDivisionErrorr0)rZconsr*gr r r rs *z(TestVariousIteratorArgs.test_constructorc Cstd}ddtddtdddd fD]}|j|j|j|j|jfD]}ttt t t fD]L}||}|||}t |t r|||qR|t|td t|td qR|t|t||t|t||t|t|q@q$dS) NZnovemberr6rZrr7r8r9rdecemberr)r4rrKr]rjrorfr!r%r+r4r  isinstanceboolr7r6rr2r3r.r/r:r0)rr*rmethr;r9r8r r r test_inline_methodss   z+TestVariousIteratorArgs.test_inline_methodsc CsddtddtddddfD]}d D]}ttttttfD]X}td }|}t ||t ||t ||||| t |t d t |t d q8|tt td |t||tt td |t||tt td |t|q$qdS) Nr6rZrr7r8r9rr<)rrrrZjanuaryr)rr!r%r+r1r4r r4rrrOr7r6rr2r3r.r/r:r0)rrZmethnamer;r*rvr r r test_inplace_methodss z,TestVariousIteratorArgs.test_inplace_methodsN)rrr rr@rAr r r r r5s r5c@seZdZddZddZdS)bad_eqcCstrtt||uSr)be_badset2rr:rr r r rsz bad_eq.__eq__cCsdSrr rr r r rszbad_eq.__hash__Nrrr rrr r r r rBsrBc@seZdZddZddZdS)bad_dict_clearcCstr t||uSr)rCdict2rrr r r rszbad_dict_clear.__eq__cCsdSrr rr r r rszbad_dict_clear.__hash__NrEr r r r rFsrFc@s$eZdZddZddZddZdS) TestWeirdBugscCsZdath}ddtdDada|t|jtdath}tdiada| tdS)NFcSsh|] }tqSr )rBrr r r r9rz4TestWeirdBugs.test_8420_set_merge..KT) rCrBrrDr2r:rrFrGr)rset1r r r test_8420_set_merges z!TestWeirdBugs.test_8420_set_mergecCsXttd}||tdt|}|ttd}|tdt|dS)Nr!)r4rrrrrO)rr*sir1r r r test_iter_and_mutates  z"TestWeirdBugs.test_iter_and_mutatecsBGfdddtfddtdDdh}|dS)Ncs eZdZddZfddZdS)z.TestWeirdBugs.test_merge_and_mutate..XcSstdSr)rrr r r rsz7TestWeirdBugs.test_merge_and_mutate..X.__hash__cs dS)NF)r)rorr r rsz5TestWeirdBugs.test_merge_and_mutate..X.__eq__Nrr rOr r r.sr.csh|] }qSr r r)r.r r r9rz6TestWeirdBugs.test_merge_and_mutate..rr)r4rrrr )r.rr test_merge_and_mutates z#TestWeirdBugs.test_merge_and_mutateN)rrr rKrMrPr r r r rHs rHc@s(eZdZdZdZdZddZddZdS)TestOperationsMutatingzRegression test for bpo-46615NcsfGfdddd|fddttdD|fddttdDdfS) Ncs$eZdZfddZddZdS)z.Badcs<sdStddkrtddkr0ttdS)NFrr/)rrr>renabledrJrDr r rs  zCTestOperationsMutating.make_sets_of_bad_objects..Bad.__eq__cSstdSrsr"rr r r rszETestOperationsMutating.make_sets_of_bad_objects..Bad.__hash__NrEr rSr r BadsrUFc3s|] }VqdSrr r_rUr r rrzBTestOperationsMutating.make_sets_of_bad_objects..2c3s|] }VqdSrr rVrXr r r rT) constructor1rr constructor2rr )rUrTrJrDr make_sets_of_bad_objectss    z/TestOperationsMutating.make_sets_of_bad_objectsc CsbtdD]T}|\}}z|||WqtyZ}z|dt|WYd}~qd}~00qdS)Nr!zchanged size during iteration)rr\rr?rN)rfunctionrWrJrDrr r r check_set_op_does_not_crash%s   z2TestOperationsMutating.check_set_op_does_not_crash)rrr rrZr[r\r^r r r r rQ s rQc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) TestBinaryOpsMutatingcCs|dddS)NcSs||kSrr r1r\r r r r2rz=TestBinaryOpsMutating.test_eq_with_mutation..r^rr r r test_eq_with_mutation1sz+TestBinaryOpsMutating.test_eq_with_mutationcCs|dddS)NcSs||kSrr r`r r r r5rz=TestBinaryOpsMutating.test_ne_with_mutation..rarr r r test_ne_with_mutation4sz+TestBinaryOpsMutating.test_ne_with_mutationcCs|dddS)NcSs||kSrr r`r r r r8rz=TestBinaryOpsMutating.test_lt_with_mutation..rarr r r test_lt_with_mutation7sz+TestBinaryOpsMutating.test_lt_with_mutationcCs|dddS)NcSs||kSrr r`r r r r;rz=TestBinaryOpsMutating.test_le_with_mutation..rarr r r test_le_with_mutation:sz+TestBinaryOpsMutating.test_le_with_mutationcCs|dddS)NcSs||kSrr r`r r r r>rz=TestBinaryOpsMutating.test_gt_with_mutation..rarr r r test_gt_with_mutation=sz+TestBinaryOpsMutating.test_gt_with_mutationcCs|dddS)NcSs||kSrr r`r r r rArz=TestBinaryOpsMutating.test_ge_with_mutation..rarr r r test_ge_with_mutation@sz+TestBinaryOpsMutating.test_ge_with_mutationcCs|dddS)NcSs||@Srr r`r r r rDrz>TestBinaryOpsMutating.test_and_with_mutation..rarr r r test_and_with_mutationCsz,TestBinaryOpsMutating.test_and_with_mutationcCs|dddS)NcSs||BSrr r`r r r rGrz=TestBinaryOpsMutating.test_or_with_mutation..rarr r r test_or_with_mutationFsz+TestBinaryOpsMutating.test_or_with_mutationcCs|dddS)NcSs||Srr r`r r r rJrz>TestBinaryOpsMutating.test_sub_with_mutation..rarr r r test_sub_with_mutationIsz,TestBinaryOpsMutating.test_sub_with_mutationcCs|dddS)NcSs||ASrr r`r r r rMrz>TestBinaryOpsMutating.test_xor_with_mutation..rarr r r test_xor_with_mutationLsz,TestBinaryOpsMutating.test_xor_with_mutationcCsdd}||dS)NcSs ||M}dSrr r`r r r rdPsz8TestBinaryOpsMutating.test_iadd_with_mutation..frar+r r r test_iadd_with_mutationOsz-TestBinaryOpsMutating.test_iadd_with_mutationcCsdd}||dS)NcSs ||O}dSrr r`r r r rdUsz7TestBinaryOpsMutating.test_ior_with_mutation..frar+r r r test_ior_with_mutationTsz,TestBinaryOpsMutating.test_ior_with_mutationcCsdd}||dS)NcSs ||8}dSrr r`r r r rdZsz8TestBinaryOpsMutating.test_isub_with_mutation..frar+r r r test_isub_with_mutationYsz-TestBinaryOpsMutating.test_isub_with_mutationcCsdd}||dS)NcSs ||N}dSrr r`r r r rd_sz8TestBinaryOpsMutating.test_ixor_with_mutation..frar+r r r test_ixor_with_mutation^sz-TestBinaryOpsMutating.test_ixor_with_mutationcCs:dd}dd}dd}||||||dS)NcSs|D]}q|D]}qdSrr r1r\rSrr r r f1dsz>TestBinaryOpsMutating.test_iteration_with_mutation..f1cSs|D]}q|D]}qdSrr )r1r\rrSr r r f2isz>TestBinaryOpsMutating.test_iteration_with_mutation..f2cSst||D]\}}q dSr)ziprpr r r f3nsz>TestBinaryOpsMutating.test_iteration_with_mutation..f3ra)rrqrrrtr r r test_iteration_with_mutationcs   z2TestBinaryOpsMutating.test_iteration_with_mutationN)rrr rbrcrdrerfrgrhrirjrkrlrmrnrorur r r r r_/sr_c@seZdZeZeZdS)TestBinaryOpsMutating_Set_SetNrrr r4rZr[r r r r rvvsrvc@seZdZeZeZdS)'TestBinaryOpsMutating_Subclass_SubclassNrrr rrZr[r r r r rxzsrxc@seZdZeZeZdS)"TestBinaryOpsMutating_Set_SubclassNrrr r4rZrr[r r r r rz~srzc@seZdZeZeZdS)"TestBinaryOpsMutating_Subclass_SetNrrr rrZr4r[r r r r r|sr|c@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)TestMethodsMutatingcCs|tjdSr)r^r4ryrr r r test_issubset_with_mutationsz/TestMethodsMutating.test_issubset_with_mutationcCs|tjdSr)r^r4rzrr r r test_issuperset_with_mutationsz1TestMethodsMutating.test_issuperset_with_mutationcCs|tjdSr)r^r4r]rr r r test_intersection_with_mutationsz3TestMethodsMutating.test_intersection_with_mutationcCs|tjdSr)r^r4rKrr r r test_union_with_mutationsz,TestMethodsMutating.test_union_with_mutationcCs|tjdSr)r^r4rjrr r r test_difference_with_mutationsz1TestMethodsMutating.test_difference_with_mutationcCs|tjdSr)r^r4rorr r r 'test_symmetric_difference_with_mutationsz;TestMethodsMutating.test_symmetric_difference_with_mutationcCs|tjdSr)r^r4rfrr r r test_isdisjoint_with_mutationsz1TestMethodsMutating.test_isdisjoint_with_mutationcCs|tjdSr)r^r4rrr r r $test_difference_update_with_mutationsz8TestMethodsMutating.test_difference_update_with_mutationcCs|tjdSr)r^r4rrr r r &test_intersection_update_with_mutationsz:TestMethodsMutating.test_intersection_update_with_mutationcCs|tjdSr)r^r4rrr r r .test_symmetric_difference_update_with_mutationszBTestMethodsMutating.test_symmetric_difference_update_with_mutationcCs|tjdSr)r^r4rrr r r test_update_with_mutationsz-TestMethodsMutating.test_update_with_mutationN)rrr rrrrrrrrrrrr r r r r~sr~c@seZdZeZeZdS)TestMethodsMutating_Set_SetNrwr r r r rsrc@seZdZeZeZdS)%TestMethodsMutating_Subclass_SubclassNryr r r r rsrc@seZdZeZeZdS) TestMethodsMutating_Set_SubclassNr{r r r r rsrc@seZdZeZeZdS) TestMethodsMutating_Subclass_SetNr}r r r r rsrc@seZdZeZejZdS)TestMethodsMutating_Set_DictN)rrr r4rZr+r,r[r r r r rsrc@seZdZeZeZdS)TestMethodsMutating_Set_ListN)rrr r4rZrOr[r r r r rsrccsXt|}z0tt|g}t|D]}|V||BVq WntyRtVYn0dS)z-Generates all subsets of a set or sequence U.N)rr>rr5r)UrSr1r r r r5s  r5cs0ddt|Dtfddtt|DS)z!Graph of n-dimensional hypercube.cSsg|]}t|gqSr r>)rrSr r r r$rzcube..cs&g|]tfddDfqS)csg|] }|AqSr r )rr*r3r r r$rz#cube...r)rZ singletonsr3r r$s)rr+r5r#r rr cubes  rcshi}|D]Z|D]Lfdd|D}fdd|D}t|||tg<qq|S)zGraph, the vertices of which are edges of G, with two vertices being adjacent iff the corresponding edges share a vertex.cs g|]}|krt|gqSr rrr`rSrr r r$rzlinegraph..cs g|]}|krt|gqSr rrrr r r$rr)r!r4Znxnyr rr linegraphs rc Cst}|D]\}}|D]}||D]}||kr4q&|||vrV|t|||gq&||D]v}||krlq^|||vr|t||||gq^||D]:}||ks||krq|||vr|t|||||gqq^q&qq|S)zKReturn a set of faces in G. Where a face is a set of vertices on that face)r4itemsrr>)r!rdredgesrZv3Zv4Zv5r r r facess&      "rc@seZdZddZddZdS) TestGraphscCstd}t|}|t|d|D]}|t|dq(tdd|D}|||t|}|t|d|D]}|t|dq|dS)Nrtrcss|]}|D] }|Vq qdSrr )rrrir r r rrz'TestGraphs.test_cube..rr)rr4r7r;rHr)rr;Z vertices1edgeZ vertices2Z cubefacesfacer r r test_cubes  zTestGraphs.test_cubec Cstd}t|}|t|dt|}|D]}|t|dq0tdd|D}|||t|}tt }|D]}|t|d7<q~||dd||dd|D].} | } |t| d | D]} | | |qqdS) Nrt rcss|]}|D] }|Vq qdSrr )rrrr r r rrz0TestGraphs.test_cuboctahedron..r rrr/) rrr7r;r4rHrr defaultdictr$r?) rr;Z cuboctahedronZverticesrZ otherverticesZ cubofacesZ facesizesrZvertexrZcubevertr r r test_cuboctahedrons&   zTestGraphs.test_cuboctahedronN)rrr rrr r r r rsr__main__)hrtestrrrr|rrrandomrrrrcollections.abcr3 Exceptionrrrrr$rr%ZTestCaserr4rrrrrr>r;r<rVr?rlrprwr{r}rrrrrrrrrrrrrrrrrrrr r r r rrrrrrr r!r%r+r.r/r0r1r2r4r5rBrFrHrQr_rvrxrzr|r~rrrrrrr5rrrrrmainr r r r s JRu     IVJ&t +     ) )$G$  1