ÿØÿà JFIF    ÿÛ „ !.%+&8&+/1555$;@;4?.451 4,$,44444444444414444444444444444444444444444444444444ÿÀ  á á" ÿÄ     ÿÄ ?    !1AQaq"2‘¡±ÁðBRbrÑá#‚’¢²3S CñÿÄ   ÿÄ !    !1QAa‘2ÿÚ   ? 5˜Z¯V¦cø)›t/? z¨±>Õ5€¶‹Á¤·¼z¼Ü¬+ñ®v¤¨_ˆR­BFn©—˜ý®ç̝P8gýt·ÉSTŦˆìät?þé¼íìN/Þa)ì–í6ô… Ï¿øÃj´¿KÇü]ÿ ªô¹-eKànëÕHTx}ýSÜ›ÿ ”7Ø×&µ<¦  ¥ÑO¶[Ù¯ä¨ÞÃÿ PZ-¬;#õ|•oaÿ ©CìÞz3˜öː/¤­ñTûIØ}š^ mÓ%ªxˆ¥ÉŸu=Z+ISe¿45™¼u;ú&WØ÷€æßQ™®{|íx*TC“#ZŠìZ§²‹ 6pv…³¿¡äª*áZÐ%ÒOáˆo"x«OHk w±æ+¬V(kMúŸ5Vö«$ ÁrÏbàb57/luR ¸ÑÛj Òµì`Мq­û žICÀÊ•©4€Âcà¨Ï€O´<èÐ:›ù(Ë^L8þ‘ÍÌ#¸Ð_Ì©ÙK(Öz 4¬û+¸;ü’V’84‘¬ÃŽ:[â‡ÔÌáõp¢~§ªlæ£ö{®G>J¼"°‡7¯ÆÉèßû ‹É‹§ÁòÃýâßî ^ƾÙõ‹×óH#«LP½ïX=xÑÍ$|W?•~• îëÔ©ª‹ {ÝT…Kÿ ”hûâá)J*ö˜–ÔU;iÇ€/ ÆþjóZ\ýwØ=Ìm ºèËL9 ýèÆð/¨’¥öo=nË.%Îì ŽÕ¯È|{Oj²ƒE6e/ßdÄõ²Ìâ1O®ò×TsəԸhOMýíMˆ¿¼H˜l²,7Â¥#MF/Úf°Ö½± ¸–dr‹NýÊ íjqx{œÉ ä-È ¦ øÄër¨q°ð †nцýÑÄÆ’mä…n<0È™;ÁÝá¯ÁZƒ7FÀmì­ É&9ˆîéi¶ùN§Y• ÃZãAâ?•‡©‰ , ó¾IŸŠc1 4â&y­&pŠ­6;M À 0¹qç»p.á …ŸÅáK@%6·y6ƒ‰3?”úºŽ‰éX5ªPT §µ!=Mž«Ú½‹ÅgÂSâÉaþÓoö–¯ÁÔìR>5éÿ üs¶ÆUcÌ kÇR ]ÿ ù¬¼«VŽ;Â|‡~¢¦”ÏŰæ {L™Õ°Óv¹ò¸írޡעCÃ!íVÕ {¶»sŒNPg/ "uÕbkm²“$ďå¿é¹§°½æz¯6 †s¿!s–wÚÝ“™Œ °.ûj>·+™Òa…©Œ&rÝÎtÛë긪Ît’LAVp%c Úý[ÄzJ¾ÇàXXç@˜ó<êL]·T˜¾¥1Ó©V‡g´æ½¦Ý@¹óø!_@´ÞâSÁ —S3™•& ]@JHÚý©ZŽ €×æÔr»Áf!‡yÞ4Mv*èÓã_{‘åóUuљØ«Oïé*®EvÑ Œ÷‡U \"㪒ÍK+À 4“M¡ï:0¥5í!'<@î´”>Ç»&Z–ïCCV˜Ì5Šo&îhè.žû |ÓK©h$s6KìŒëã)¹hI¦GïOåóI;ììü#É$Š0…Ææ¥TØ.5­¾gn´ “ÂÖ\:hœ89G)J@„}œ:’Ò{/Š"¦_Æ×7Æ3VÇŠÊa]ÚŒÙ€Ä–=®uÁßâACZƒ§§£ Qnâ:«,×{tyø¬iÛcœÜÄ€H½ÄÍCk´÷šß .W'b¤Íåh]÷€=,Žv×cÚEÚHXJX¶îo¨FÒtèöŸ>ªª6[J®Fµ£sGÁeqõfe\íjÒÐïÄÐGˆe1Ø‹.Ø”‘Ëuø Y­ˆÜ ŽG|zùªüMpDnQWÄ”%JŠ™)â*p@Örš«ÕT2Ð%ˆG#ª„ ·¤!°ŸOTÂT¸aÚ%4&h™LµšØüÐ.F¿²ÐÞ_Ç‚¾ÅÃaÜ÷09Æ q€öy˜v‡85õN÷]¬äѼóS{°_MެúÔ#°Ç¸0åÞè2ëôPcvÆw9®ií1Ä8F™˜à‰´+‰Ik1òÝ7“Ñ×ÒsÝ\x‚h`ÞÑ`ó"|µEcý£n˜h`}GÞ !±ù²Ápü²ß6 0ïi󜵩SÈÇ7˜-ÕURO˜¦´f$ªž-Í6(œ}<„ éc øs]ŽŽ„*—¾ ìdŽ„)méª\¿êÎIg¾ØÞ~I#C/¼¼´EÁÈŽi8“©õådô·>euä ƒ'Ê×लR1ÉJE1ÐAát`t;ÇР%Ý<‡¥„ÍÆ`×Oyó)õiI€ñQaŸ4Ûù\áàaÃÔ¹HÃu¹*k€¦<„e S‡&õÏ B!ŽhüÞ`yj}mªf×\¿ Ç~æ­9‡û\՞Ǖg²1Žû5V7 !àöšm° c`ܬøÇìµÒ'P"?…´Ö,"§^•õލsÔ)6˜sæéÍR¼ ò|Sl”‹7 nPW Gòú÷½§O¯‡„l¡kSÞŒr½PÊ@æ¢pŽ-mÿ #Ÿ˜Àº¶Áä¦;ïÔæ$1££`“Õ>„—·ž)ßð³ñ#Ï Ô$¶œ‰ÊE‹À;÷º ¯«P:Ñ”8–IÊtpÞ3ª“>ê“þës4ò2OÏÕ­±zô†Õ§‰.÷ä¸;¿˜“'œ›žª}«Œ{ª±Ì 9ÔóÞÕ‡0 $íWV3Üì¬ —@kÝ4@¿r¼±½¬™›?øØæ´'Áé®CË3-g$˜ö‡×auÚi´Žp/êÛ æF›Ú2v‹ã¿¿,nB1̨ƃqÞa5͝@&Æû“él÷ \C²½UÍc ¯k×¢U ÖéQå™—-r wô ÞÏ<Ò=&=ÿ Ôê Òêˈt,i—;LîÜ á¸*ÚÃ1$êL•LÍ <É)ýÐà’ ;F™{ƒ™˜€&'}‚ãÄK`¡ÞT@I;®žZóè‚s’7®°›+§O­Åq©é»²9<Ô J ¼9O’HL»Ùïì¸rk¼Ž_ý‘TŸu[²ßÚŒ·ü÷B%¯E ŸÔX5êO´ Ç•€’I0 ÉJX` ñ¹õ%;µŸD‘«´€àwÒ™U ûئžÖö\×®×´8 ½‡ºÐÆÓ§?Àkmœ=;d5*@-ì0F Rªýš[Ü6âö̃ڸr*KA9· u*µæ£?U¸Âêí†8@¦X4 e-ò„0s{ HâUpU?¼mñRa°®a%Ð'tÉ×’\¾ÊÉ]t›h>·(Ë@R¼¡Ãt h}’O÷au<+nT…Ö…MӐ??Óe95 q>í/;&JSû °¯ÊéÞ øƒ*Ã2½Ài&:nôUl=¾¿5eˆ3”ñc|Ú2V”>„»&eE;«ÚäC p¢Û úy 9š[ŒÌx¼擼A&DåÒ¯ˆ¤ÀÌ;"˜ ÏQä¸åhÊ}Ûq«Û0WžÒ|»€ø®öCm5•\ÇÀ§Pe3£]0ÃàLDÉ‰1øªxjgwT‚÷¿LΨK‹›ùs—xˆÜ±µ kæ¸f‰‰ÜGk/LÛØ6d9ò¶ùA{ƒA3š/¬D¬khÓk‰`˜"㯒r¿±Óã jx‡°e}<Ñø\3y:'À•/h½Í€Ç4~g ?Û(¼]v‘ªlKÎâ~?O‚W%{Ì:“'©úNq¾›úo(X’¥¯ˆ nFê{Ç€ü?º'ë ø‹ì Þ09ŒÌç9Æ —ËC`j@ÓÄ(+a‹un¸#ÂꟋ{K`‘ÑÍÍ'à´»/Û,KW;Þ4²þð ï Nm|~fGÏ(…³Ã)«1ö­Õ ¥‡¨©ƒÃ™ü-s=à=U66Ï«Ýc蓦W¹íž®›nÔ%êÇìŒ<#Ü×84ån®Ð ÒåOC` ñânÑs‡¢ç 1õ%Îhì½Ã½® e:ݼUZo™`  ÅZŸŒÊ«ê1ÏÄo$q¹Þ€©ˆhÐÉä¯ñ[!…Ú˜àJ:x2$Íß&PåT£6ç— ‡Í*4Ýšçjÿ ‰É nófÐ ó(L5C•åÆ\rMÒ@ò }y-W}™üýVù—ú¢=Ù”c®‘< M ž ´Phr ¦©TD ‘ù.$´÷O‡‘V2Æò.=IUŒ=ž‡â¬i™aþÓåÙ?òUø'ØÖ•.~* šTŒ!•-×áºTâ®ä#õü'´ eýlYÅÓeÕKÂrT"CÚ@u!Óxƒ{š3€}1¿(r}%«nËamjÑ%ÑNEò v ˜à  σöK³,*º.àzù¨™Ó ÚçâU¦*¿ 9{%Ö¹ njûdaXöb) kÛÆ±ûÓ\°M7ˆÂ=û›ç¿Ã‚­V»Cg–8ÙêE- j)k$º`Ã-ùEýeBÆÇ]c¡°ñty&Òd0nõ'¡W+ƒ*|–øµFa\GQªEAÔp5\Ǽ·¼Ç8·õ -â§Ú[ ‡ uZeÖ 3}×d'+¹:ð+K†Û®s!Ï$úe€<Û”x)1»a­¡LC]¸µík…ÚàA»AYº{†ªS[¦5HÒ7ù --,ísòDØ€èk ÞÀîÜ ò@â( ËNˆë›4ô½•/¦o‡€Û7 ê•ÆêòðÜy'Án½µ á˜ݦ ndeo…[ì¶Ê,¥R³Ä=À±—–ß;£™´ñSâ*g§”ïaið‘Jå~™ÓÞ ß³Õ¢»8x埒²52>AÊb&-÷\7´éÄù€T˜,w;3{ï˜k…à¹ÄqÀ«œ{€\ ˆ¾[´¨јr &Úé„Ívˆ±8†¿]|¬ņ4I×pÞS1ÈÖz‰#Ìv‡G!YNògñ:màTz¢Ý1ô©^O=~ë|5Bã™ç•¼µõ•bÆ@úÕS¬ÈŒ#¬zünrŸ û” Z²•èðV"ÁHÚý©wÝ €7¼Ìu1hÑa3Éä û f$o¿É ™Ú›ÝçnpÒ3äÌ3†Í§,Äï]$‰/pê †«À¼¸e9­Æê_C]žƒ·ý·frÁN«, E=›Çq -‰öŒ:aÏ¿±í&£Í:-} 84‘ÿ eƒQÑeëSsuiA ³g㟥ú£?ÿ ʼn*”“÷aühe:ÊWa@ÒÞk±eØ] F Ô—r.åä˜ @ö¥ªZoÐýYL·¥S²G/‡ñ <~*ZÆ´è>JlòàÛÆ½ÿ 窘ìGN¢:I®KšJp/`íIÁÀõ#Ä-€ö­šµŒoF4|ÆQØÆ@Ì|£Ô…¢À{9˜è½Üó›€ôYÒÎYsið;ís¤€à²ˆ‚4qÉVŒI$ ‰"° æµ8cXGjœˏ¡Aâý•ËÜ¢ûï e·çLx']á"oÅÎê3¯Ç—¹”ó0nå‚âg{Œñ> S´˜îè°g238‚ãköÝfÚd´6Ò€;ò÷±¢™¼›º ¢Æ'¥Ðx'e¬ç ]bÈÆV¢ó‹kýBO ðÊâ$Ÿ!×T 3Mýמ žìٍàÌü‘8÷€àæØ8æ©6‰©L´«…oãpð„~Çk‰!ñ;‹”ÛžÍ àž±z Ÿôû øŸÝužÏ;ÿ #|u6™Þ¬ÚˆÐõA4¶â|ôl|Ê2ŽÇ¤ÝÅÇY.<#Aí.k§hóF‚”Y; M½Ö4hŸ4&›­¿tès´%FìL¥£Ãk‰ÇT¤haÁ¤ÚxfÉ`ÑìË›>i 3t‚:,–+^÷´–{Û–Nxi"x‘Ûg î¨>¥Õ܁ùZH,2Û“:8xÊ¢Çí9.É-Ìâã-=çjwµS˜dütžçwýGòú®®ûº_ˆýx$–¡ãøO EÚÛÏ÷R„×w+3£Á£öUMyR²¹âŒ°š›¸Ñãò9§Ó_Dl+Ùßc›úšGÅÌc†Ž!Ko=¶.‘Îÿ c²(2®V mª.ÿ ¹B›¹å ù„öŸSV>™ü¯$y:G¢Z×àøúdî¹û­·ýÇ´:•c LÍõi_‹ö+ÎæGÊè>OŠ•äž´§Þ{X}¨1ÚTc›»Qþ•êô°t¿OP?eæ~É{5]•ÙR£r5†nZ\ã@ &îJõ ¾àC°þV>fé¥/ü5ñÊIº_é5 ;e­h<@ Ä&æÃëE%;X,ÒãÆÞ`Oò¦kŸm#˜!ÀyÄ¢| óLšò¥Ä` ¶R=|ÈCâh5ò3DˆïF†ðÒ#ÅìÛœ?¸yhBãœí ZxßÎÄhºRK„`Þödvײ™ÀÈÑÒgŒuY w³%†ƒÓzõ ÖÏp‚dH®¦A´ù§»ÓÇMæ~)ˆð‡û:ù&Ä •vGD´À n ݇¼Ö8Fö óáà£~Ë¥x`oK|Ä?fxiØü%pìR>éò+Û±éÎ>núlFŤ'tq8LZÏvÃ?„¡ß±È⽆¯³íü@x|PöUäèØã¡ð‚ŒAìÏ"vÍwóŸÍ{ ý0.z È•Ö{,N¡£¡ŸKÕÙž>Ýœþ ÍÀ°<×EA!Å‚D™IúOÍ¡>ôG}Â` ÍßkÜL™Ž Þð™ {IøF²¹òQ3&!ÃÂÞz.d&Ï-sH¸,Ôõ˜ŽP€ 77ˆÝ¼ÊëÜw =cÕ Ú,ØÐ5ÎYÐ)ì´öœgŒ[¤ßv㙑8心>h]§µháYš£²ºÑ.{Ï7Sð•?´~×SÃKýJÛ˜ ™Íäiúu<µX¶1õ^kâçIÑ£sZ4h>j*ÔšD:4­¿_ ÷¸ Õxæÿ ¸?Mù _•­ÊÐ ä ÷ý ÑwL œ­ïnTkÛUÍN©ë:¦fV ¶ÜÔÜMªÅâA½–¿R×TXš-%iTÊT•‡Ù‚JôϐZxWÑè‰f‰òG º ×Õû2aZ7OU3[“×AT–ÞŒ…-‘¤”Ì ì&(ˆ¿­•ƒkï’:ðY¦W‘ Å)“†‘˜³Åtcø˜ñTÂwÚÇ4|üLÇªí–v- qˆèU qPE.†â‘˜µ Æ,ÐÅs]8¾„oúÑ i>ÜxxÈó)ƒ ´æÁâØ$À‰vžŸf$Ž |ãw;ÀÁIJ»b` {¦Ó¤Ú$©YÀ‘n@Óïž«9J¼êG m¤ ܯ¹ÌW4€ÐÒÅÛ‡#褕Ÿn-?í|с¥÷Ú¹¬'´ÞÜ9ÓK `hê£SÄSà?7—Wí_´…óB›»:=Ãïq`<8ñÓŒÑlú2d¬ê³£hÖ[l|$vÝro~'R®‰§°ñmY ͧäP |PUª¹·:3Œ[Û{Xÿ ºâ@‚W–Äé u‚ ¯´*=íή.pûÒdt @G‰¬ s¸ ëÉücr ÞæÑ¨Ê@>¤¢Ö±. Þ'¯°ÌME[YéïĵÂCå½ Ué©Áû'Ê9%eÔðNU”ë‘ÌsD3/®+UI˜9h.WC”빓$#:pz:YÓ ¿xž* ³$Í +$kñAŠ‹†¢ Uê>¸)_š¬÷©ßAÂÔb9ÇU ¯¾á•9¯ÏÏ÷O÷¼¼Fähal1‰3Ì[Ïr•´UCksNÐ] R‘¸¥H+§Šé†c©vÖÞ0iÓ76s†î!§=ß ¼~Ô'°Ãmäoäš³ªøi1úÉ)³yV8 CLÄØÁ‘WYïi€H6ÖÑiámø^ÈY´°Ñ7¥Û*—Ñ©L«Qƒï—Ùrÿ ›£Ð*š¸ˆL©ˆ$ˆ ÷¾D§9È®«qbqC)–ˆïv´çñsÑVT­Ø, <àïºÀO«Jý·õ àfPìð .wFšir´þ’2_Y *Æ€x\« ì€9š@ Ž|F⇥ˆkZ@hÖÄ0t¿-<“‹qµ¾*ZL¤Ú)&BJpÓF5=$„at*Zš$’ÑtdûÝRI1 2މ$€$I$#‰SÞ’Hë¬ï;Á$¡t$’`<(ñÇt)$‡Ð.Êf¢X’Kt=Éé$‚ˆªè¢oÝëòI%Rgcª÷ŠyI%¡‰ÿ !ñ)´õ $¤ Ô’IIGÿÙa 3g;@sXddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlZddlmZddlmZmZmZddlmZddlmZmZmZmZmZmZmZm Z m!Z!m"Z"edZ#edZ$dZ%d Z&gd Z'd d Z(Gd ddZ)Gddde)ej*Z+eGddde)ej*Z,e Gddde)ej*Z-e!Gddde)ej*Z.GdddZ/Gddde/ej*Z0eGddde/ej*Z1e Gddde/ej*Z2e!Gdd d e/ej*Z3Gd!d"d"Z4Gd#d$d$e4ej*Z5eGd%d&d&e4ej*Z6e Gd'd(d(e4ej*Z7e!Gd)d*d*e4ej*Z8Gd+d,d,ej*Z9Gd-d.d.ej*Z:Gd/d0d0ej*Z;Gd1d2d2Ze Gd7d8d8ed>ZBGd?d@d@eBej*ZCeGdAdBdBeBej*ZDe GdCdDdDeBej*ZEe!GdEdFdFeBej*ZFGdGdHdHZGGdIdJdJZHGdKdLdLej*ZIeGdMdNdNej*ZJGdOdPdPej*ZKGdQdRdRej*ZLGdSdTdTej*ZMGdUdVdVej*ZNeOZPGdWdXdXZQdYdZZRd[d\ZSGd]d^d^ej*ZTeUd_krTeVdS)`N) TemporaryFile)randintrandom randbytes) script_helper) TESTFNfindfileunlinkrmtreetemp_dirtemp_cwd requires_zlib requires_bz2 requires_lzmacaptured_stdout2dZzipfile_datafiles))Z _ziptest1Z 1q2w3e4r5t)zziptest2dir/_ziptest2Z qawsedrftg)z!ziptest2dir/ziptest3dir/_ziptest3Z azsxdcfvgb)z-ziptest2dir/ziptest3dir/ziptest4dir/_ziptest3Z 6y7u8i9o0pccs|tVt"}|V||jWdn1s40Yt"}|V||jWdn1sn0YdSN)TESTFN2r assertFalseclosedioBytesIO)testfr0/opt/python39/lib/python3.9/test/test_zipfile.py get_files%s* rc@seZdZeddZddZdBddZdCdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z dd?Z"d@dAZ#dS)DAbstractTestsWithSourceFilecCs&ddttD|_d|j|_dS)NcSs g|]}td|tfdqS)z'Zipfile test line %d. random float: %f ascii)bytesr.0irrr 1s z:AbstractTestsWithSourceFile.setUpClass..)rangeFIXEDTEST_SIZEline_genjoindataclsrrr setUpClass/sz&AbstractTestsWithSourceFile.setUpClasscCs:ttd}||jWdn1s,0YdSNwbopenrwriter+selffprrrsetUp6s z!AbstractTestsWithSourceFile.setUpNc Cs||d}tj|dfi|z}|td|tt|d|j|jddd&}|jD]}||q\Wdn1s0YWdn1s0YdS)N) compression compresslevelw another.namestrfilewritten-open-wmode)zipfileZipFiler3rwritestrr+r2r))r5rr8r9kwargszipfplinerrrmake_test_archive;s    z-AbstractTestsWithSourceFile.make_test_archivecCsD||||t|d|}||t|j||d|j||d|jt}|j |d| }| }|t |d| d|d| d|d| d |d|d \}} } } ||d|t| d |t| d || tt |j|} |t | d | t| | d| | d| | d| |} dd| D} |t | d | t| | d| | d| | d| | D]}||jt |jqtdddfD]2}||}||j|||jt |jq|Wdn1s60YdS)Nrr;r<)file File NamerModifiedSize%Y-%m-%d%H:%M:%Sr=cSsg|] }|jqSrfilenamer"rrrr%jr&z8AbstractTestsWithSourceFile.zip_test..)rFr@rA assertEqualreadrr+rStringIOprintdirgetvalue splitlineslenassertInsplit assertTruetimestrptimestrnamelistinfolist file_sizegetinforRtestzip)r5rr8r9rDr6 directorylinesfndatetime_sizenamesinfosr$nminforrrzip_testFsL           z$AbstractTestsWithSourceFile.zip_testcCs t|D]}|||jqdSrrror8r5rrrr test_basic|s z&AbstractTestsWithSourceFile.test_basicc Cs|||t|d|}g}|t,}|d}|sr<rr)rrr@rArBr+r8tellrWr2truncate assertRaisesEOFErrorrTr)r5r6rZ end_offset zipfiledatarrrrtest_truncated_zipfileLs2&    b     d     z2AbstractTestsWithSourceFile.test_truncated_zipfilec Csd}t|D]}t|d|j0}|t|t|}|d|Wdn1sX0Yt|d&}t|}t|t r|d||n|d|||d|t| |}|d|||d||d ||jtj kr|d ||d || |N}t|}|d |||d||jtj krX|d |Wdn1sn0Y|d t|Wdn1s0Y|d t|q dS)Nz file.namer:zmode='w'rGz filename=%rzfile=%rzmode='r'z filemode=z file_size=zcompress_type=zcompress_size=zname=%rz[closed]) rr@rAr8r3rreprrZ isinstancer_rc ZIP_STOREDr2)r5fnamerrDrGrrrr test_reprjs6 *        ,0z%AbstractTestsWithSourceFile.test_reprcCs$t|D]}|j||jddqdS)N rrprqrrrtest_compresslevel_basics z4AbstractTestsWithSourceFile.test_compresslevel_basiccCstjtddd\}|td|jtddd|d}|d}||jd||jdWdn1sr0YdS)Nr:rMrZ compress_1Z compress_9r)r@rArr3rrcrSr)r5rDZone_infoZ nine_inforrrtest_per_file_compresslevels   z7AbstractTestsWithSourceFile.test_per_file_compresslevelc sGfdddtj}d|}dt|d|j}|dd}|dWdn1sd0Ydztz:|dd}|dWdn1s0YWntyd 7Yn0WdWdqjWdnd0Wdn1s0Ytt|4}| | dg| | ddWdq1s^0Yqtt|H}| | ddg| | dd| | ddWdn1s0YdS) Ncs eZdZfddZZS)zCAbstractTestsWithSourceFile.test_writing_errors..BrokenFilecs,durkrtd7t|dSNrM)OSErrorsuperr3r5r+) __class__countstoprrr3s zIAbstractTestsWithSourceFile.test_writing_errors..BrokenFile.write)__name__ __module__ __qualname__r3 __classcell__rrr)rr BrokenFilesrrr:Zfile1sdata1Zfile2sdata2rM) rrr@rAr8r2r3rrWrSr`rT)r5rZtestfilerDrrrrtest_writing_errorss0 (, ,4z/AbstractTestsWithSourceFile.test_writing_errorscCsttttdSrr rrr5rrrtearDownsz$AbstractTestsWithSourceFile.tearDown)N)N)$rrr classmethodr.r7rFrorrr{r}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.sB  6      %rc@seZdZejZdZddZddZddZ dd Z d d Z d d Z ddZ ddZddZddZddZddZddZddZdS)StoredTestsWithSourceFileNcCsl|||t|d@}|d}||jd|d}||jdWdn1s^0YdS)NrGr<r=)rFr@rArcrS external_attr)r5rr8rDzinfoZzinfo2rrrzip_test_writestr_permissionss    z7StoredTestsWithSourceFile.zip_test_writestr_permissionscCs t|D]}||tjqdSr)rrr@rrqrrrtest_writestr_permissionss z3StoredTestsWithSourceFile.test_writestr_permissionscCsttdtj}|tdWdn1s20Yttdtj"}||dgWdn1st0YdS)Nr: /absoluterGabsoluter@rArrr3rrSr`r5rDrrrtest_absolute_arcnamess*z0StoredTestsWithSourceFile.test_absolute_arcnamescCsttdtj}|ttWdn1s20Yttdtj2}|d|j|| tdgWdn1s0YdS)Nr:ar<) r@rArrr3rrBr+rSr`rrrrtest_append_to_zip_files *z1StoredTestsWithSourceFile.test_append_to_zip_filec Csd}ttd}||Wdn1s.0Yttdtj}|ttWdn1sj0Yttdp}|t|t|d6}| | tg| | t|j Wdn1s0YWdn1s0Yttd.}| | t||| }Wdn1s>0Yt |b}t|6}| | tg| | t|j Wdn1s0YWdn1s0YdS)NI am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!I am not a ZipFile!r0rrbrG)r2rr3r@rArrseekrYrSr`rTr+rr)r5r+rrDrbiorrrtest_append_to_non_zip_files  (* P (z5StoredTestsWithSourceFile.test_append_to_non_zip_filec CstT}t|dtj}|ttWdn1s<0Y|}Wdn1sb0Yd}tt d$}||||Wdn1s0Ytt 6}| | tg| | t|j Wdn1s0YdS)Nr:rr0)rrr@rArr3rrWr2rrSr`rTr+r5rrDrr+rrrrtest_read_concatenated_zip_files *&  ( z9StoredTestsWithSourceFile.test_read_concatenated_zip_filec CstT}t|dtj}|ttWdn1s<0Y|}Wdn1sb0Ydd}tt d$}||||Wdn1s0Ytt d0}| | tg| d|j Wdn1s0Ytt d.}| |t|||}Wdn1s>0Yt|x}t|L}| | tdg| |t|j | |d|j Wdn1s0YWdn1s0YdS)Nr:sI am not a ZipFile!i@Br0rr<r)rrr@rArr3rrWr2rrSr`rBr+rTrYrrrr$test_append_to_concatenated_zip_file s$ *&  (, (z>StoredTestsWithSourceFile.test_append_to_concatenated_zip_filecCsttdtj}|ttWdn1s20Yttd}|dWdn1sf0Yttd}||tjWdn1s0YdS)Nr:rz rG)r@rArrr3rr2rr5rDrrrrtest_ignores_newline_at_end#s * (z5StoredTestsWithSourceFile.test_ignores_newline_at_endcCsttdtj"}d|_|ttWdn1s80Yttd}|dWdn1sl0Yttd,}||tj| |jdWdn1s0YdS)Nr:this is a commentrzabcdef rG) r@rArrcommentr3rr2rrSrrrr)test_ignores_stuff_appended_past_comments+s* (zCStoredTestsWithSourceFile.test_ignores_stuff_appended_past_commentsc CszttdZ}|tttd&}||t|Wdn1sN0YWdn1sl0YdS)Nr:r)r@rArr3rr2rSrTrrrrtest_write_default_name5s  z1StoredTestsWithSourceFile.test_write_default_namec Csd}tjtdd}||dWdn1s40Ytjtdd}||`}||t|j|t|j d|t|j |t|j |t|j Wdn1s0YWdn1s0YdS)N somefile.txtr:r>bogusrGr) r@rArrBr2closer ValueErrorrTrrreadableseekable)r5rrDZfidrrrtest_io_on_closed_zipextfile=s* z6StoredTestsWithSourceFile.test_io_on_closed_zipextfilec Cstjtdd}|ddWdn1s00Ytjtdd }|t|jtWdn1sn0YtjtddH}|t|jtddWdn1s0YWdn1s0YdS)Nr:r>rrrG) r@rArrBrrr3rr2rrrrtest_write_to_readonlyKs*. z0StoredTestsWithSourceFile.test_write_to_readonlycCsttdttd }|t|jtWdn1s>0Ytjtddd2}|t| t}| |j dWdn1s0YdS)N)rrr:FZstrict_timestampsirMrMrrr) osutimerr@rArrrr3rcrS date_time)r5rDrrrrtest_add_file_before_1980Xs .  z3StoredTestsWithSourceFile.test_add_file_before_1980cCs$d}zt|Wn$ty6|d|dYn0ztt||fWntyh|dYn0ttj}|dkr|d|t t d"}| t j|jtWdn1s0Yt j t ddd 2}|t|t}||jd Wdn1s0YdS) Nl& ztime.localtime(z) raises OverflowErrorz/Host fs cannot set timestamp to required value.lb fz,Linux VFS/XFS kernel bug detected: mtime_ns=r:Fr)i; ;r)r] localtime OverflowErrorskipTestrrrstat st_mtime_nsr@rArrstructerrorr3rcrSr)r5tsZmtime_nsrDrrrrtest_add_file_after_2107cs$    0  z2StoredTestsWithSourceFile.test_add_file_after_2107)rrrr@rr8rrrrrrrrrrrrrrrrrrrrs      rc@seZdZejZddZdS)DeflateTestsWithSourceFilecCsttdd}|tdtj|tdtj|d}|d}||j tj||j tjWdn1sv0YdS)Nr:ZstoremeZ deflateme) r@rArr3rr ZIP_DEFLATEDrcrSr)r5rDsinfoZdinforrrtest_per_file_compressions  z4DeflateTestsWithSourceFile.test_per_file_compressionN)rrrr@r r8r rrrrrsrc@seZdZejZdS)Bzip2TestsWithSourceFileNrrrr@ ZIP_BZIP2r8rrrrr sr c@seZdZejZdS)LzmaTestsWithSourceFileNrrrr@ZIP_LZMAr8rrrrrsrc@sHeZdZeddZddZddZddZd d Zd d Z d dZ dS)AbstractTestZip64InSmallFilescCs$ddtdtD}d||_dS)Ncss|]}td|dVqdS)zTest of zipfile line %d.r N)r!r"rrr sz;AbstractTestZip64InSmallFiles.setUpClass..r )r'r(r*r+)r-r)rrrr.sz(AbstractTestZip64InSmallFiles.setUpClasscCsVtj|_tj|_dt_dt_ttd}||jWdn1sH0YdS)Nrrr0) r@ ZIP64_LIMIT_limitZIP_FILECOUNT_LIMIT_filecount_limitr2rr3r+r4rrrr7s  z#AbstractTestZip64InSmallFiles.setUpcCsrtj|d|dd6}|td|tt|d|jWdn1sN0Yt|d|}||t|j||d|j||d|jt }| || }| }|t |d|d|d |d |d |d |d |d \}}} } ||d|t|d |t| d|| tt |j|} |t | d|t| |d| |d| |} dd| D} |t | d|t| |d| |d| | D]} || jt |jqtddfD]2}||}||j|||jt |jq|Wdn1sd0YdS)Nr:TZ allowZip64r;r<rGrPrJrrKrLrMrNrOcSsg|] }|jqSrrQr"rrrr%r&z:AbstractTestZip64InSmallFiles.zip_test..)r@rAr3rrBr+rSrTrrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrRrd)r5rr8rDr6rerfrgrhrirjrkrlr$rmrnrrrrosN  ,         z&AbstractTestZip64InSmallFiles.zip_testcCs t|D]}|||jqdSrrprqrrrrrs z(AbstractTestZip64InSmallFiles.test_basiccCstjtd|jdd}d|_d}t|D] }|d|d|dd q&|t| || ttd |j}|t| |t|D]0}| d| d }||d|dd q| dS) Nr:Trrfoo%08d%dr9rGr ) r@rArr8debugr'rBrSrYr`rrTdecode)r5rnumfilesr$zipf2contentrrrtest_too_many_filess   z1AbstractTestZip64InSmallFiles.test_too_many_filescCs$tjtd|jdd}d|_d}t|D] }|d|d|dd q&|t| || tj  |d|d Wdn1s0Y|t| || tjtd |jdd}d|_|t| || tj  |d|d Wdn1s0Y|t| || tjtd |jd d}d|_|t| |d }t||D]"}|d|d|dd qx|t| || ttd|j}|t| |t|D]2}| d|d}||d|dd q| dS)Nr:Frrrrrrrr&rTrrGr )r@rArr8rr'rBrSrYr`r LargeZipFilerrTr )r5rr!r$Z numfiles2r"r#rrrtest_too_many_files_appendsJ  . 0   z8AbstractTestZip64InSmallFiles.test_too_many_files_appendcCs$|jt_|jt_ttttdSr)rr@rrrr rrrrrrr*sz&AbstractTestZip64InSmallFiles.tearDownN) rrrrr.r7rorrr$r&rrrrrrs  9'rc@sTeZdZejZddZddZddZddZ d d Z dd d Z ddZ ddZ dS)StoredTestZip64InSmallFilescCsJtj|d|dd$}|tj|jtdWdn1s<0YdSNr:Frr;)r@rArr%r3rr5rr8rDrrrlarge_file_exception_test5sz5StoredTestZip64InSmallFiles.large_file_exception_testcCsLtj|d|dd&}|tj|jd|jWdn1s>0YdSr()r@rArr%rBr+r)rrrlarge_file_exception_test2:s z6StoredTestZip64InSmallFiles.large_file_exception_test2cCs.t|D] }||tj||tjqdSr)rr*r@rr+rqrrrtest_large_file_exception?s z5StoredTestZip64InSmallFiles.test_large_file_exceptioncCstjtdtjdd}|tdWdn1s60Yttdtj"}||dgWdn1sx0YdS)Nr:TrrrGrrrrrrrDs *z2StoredTestZip64InSmallFiles.test_absolute_arcnamescCstjtddd}|d|jWdn1s40Ytjtddd }|d}|j}Wdn1st0Ytjtddd}|d|jWdn1s0Ytjtddd(}|d}||j|Wdn1s0YdS)Nr:Trr<rGrZstrfile2)r@rArrBr+rcextrarS)r5rDrr-rrr test_appendLs, $, z'StoredTestZip64InSmallFiles.test_appendFcCsd}d}g} g} |} |r4d} |r4| || |td| } |} |rdd} |rd| || |td| } |} |rd} |r| |td| } tjddt| ddt| g| R}tjddt| ddt| g| R}tdd dt| }tdd dt| }td d dt| }td d dt| }d }d}td t|}d| | |||||d| | ||d| ||ddd||dddd}|S)Nrlz0Y|dt|j  |jdddd}|tj }tt|Wdn1s0Y|dt|j  |jdd}|tj }tt|Wdn1s0Y|dt|j  |jdddddd}|tj }tt|Wdn1sf0Y|dt|j  |jd dddd }|tj }tt|Wdn1s0Y|dt|j  |jddd dd }|tj }tt|Wdn1s20Y|dt|j  |jd d dd }|tj }tt|Wdn1s0Y|dt|j  dS) NT)r5z file size)r5r6r7z compress size)r7)r5r6r7r8r9z header offsetF)r5r7r8r9)r5r6r7r9)r5r7r9) r=rr@ BadZipFilerArrrZr_ exceptionlower)r5Zmissing_file_size_extraeZmissing_compress_size_extraZmissing_header_offset_extrarrrtest_bad_zip64_extrasp...0000z0StoredTestZip64InSmallFiles.test_bad_zip64_extrac Csd}d}d}d}dddddddddf}tdt|dD]}t||D]}i}|D]} || qZtt|j fi|X} | d} | | j || | j || | j|| | | |WdqN1s0YqNq>dS) Nr/rr3T)r5r6)r7r8)r9r:rM)r'rY itertools combinationsupdater@rArrr=rarSrbr;r<rT) r5Zexpected_file_sizeZexpected_compress_sizeZexpected_header_offsetZexpected_contentparamsrGZcomborCczfrrrr test_generated_valid_zip64_extras&  zr&zCPyZipFileTests.test_write_filtered_python_package..Z filterfunccSstj|d S)NZbad)rrrv startswith)rrrrfilterszAPyZipFileTests.test_write_filtered_python_package..filter)rrrrkrlrhrr@rmrrurWr\ assertWarns UserWarningprint)r5rr{rxrDZ reportSIOZ reportStrrrrr"test_write_filtered_python_packages& (0Nz1PyZipFileTests.test_write_filtered_python_packagec Csddl}tj|j}||dr(dnd}d}tr}tj|d|dB}| || }| d||| d||Wdn1s0YWdn1s0YdS) NrFrMrir:)optimizezemail/__init__zemail/mime/text) rzrrrkrlrhrr@rmrur`rZ)r5rzr{ZoptlevelextrxrDrkrrrtest_write_with_optimizations   z+PyZipFileTests.test_write_with_optimizationc CsnttzRttjtdd}|dWdn1sB0Yttjtdd}|dWdn1s0Yttjtdd}|dWdn1s0Ytt}t |dF}| t| }| d|| d|| d|Wdn1s*0YWdn1sJ0YWttn tt0dS)Nmod1.pyr: print(42) mod2.pyprint(42 * 42) zmod2.txtz bla bla bla rmkdirrr2rr*r3rr@rmrur`r`rwr r5r6rxrDrkrrrtest_write_python_directorys (((   Nz*PyZipFileTests.test_write_python_directoryc Cs*ttzttjtdd}|dWdn1sB0Yttjtdd}|dWdn1s0Ytn}t |dB}|j tddd| }| d|| d|Wdn1s0YWdn1s0YWttn tt0dS) Nrr:rrrcSs |d S)Nr)rn)rgrrrr~szEPyZipFileTests.test_write_python_directory_filtered..rrrrrr$test_write_python_directory_filtereds (( Lz3PyZipFileTests.test_write_python_directory_filteredc Cst}t|d\}ttd}|dWdn1s@0Y|t|jtt tWdn1sv0YWdn1s0YdS)Nr:z!most definitely not a python file) rr@rmr2rr3r RuntimeErrorrur )r5rxrDrrrrtest_write_non_pyfiles  (z$PyZipFileTests.test_write_non_pyfilec Cs"ttzttjtdd}|dWdn1sB0Yt}t |dz}t $}| tjtdWdn1s0Y| d| |}| d||d|Wdn1s0YWdn1s0YWttn tt0dS)Nrr:zBad syntax in python file r}zmod1.pyc)rrrr2rr*r3rr@rmrrurZrWr`rwr )r5r6rxrDsrkrrrtest_write_pyfile_bad_syntaxs (2 Jz+PyZipFileTests.test_write_pyfile_bad_syntaxc Csttzttjtdd}|dWdn1s@0Ytd}t |d8}| t td| }|d|Wdn1s0YWdn1s0YWttn tt0dS)Nrr:r)rrrr2rr*r3rr@rmrurrr`r`r rrrrtest_write_pathlike,s (Jz"PyZipFileTests.test_write_pathlikeN)rrrr`rhryr|rrrrrrrrrrrr]ys r]c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZeejjdkdddZeejjdkddd Zd!d"Zd#S)$ ExtractTestscCsNttdtj*}tD]\}}|||qWdn1s@0YdS)Nr:)r@rArrSMALL_TEST_DATArBr5rDfpathfdatarrrmake_test_file<s zExtractTests.make_test_filec Cst|ttd}tD]\}}||}tj t |}tj |}| ||t |d$}| ||Wdn1s0Yt|q"Wdn1s0YWdn1s0YdSNrGr)r rr@rArrextractrrr*getcwdnormpathrSr2encoderTr )r5rDrr writtenfile correctfilerrrr test_extractAs     2zExtractTests.test_extractc Cs|ttd}tD]\}}|||}tj||}tj |}| tj ||||ft |d$}| ||Wdn1s0Yt|qWdn1s0YttdSr)rr@rArrrrrr*rr\samefiler2rSrrTr )r5targetrDrrrrrrrr_test_extract_with_targetTs    2(z&ExtractTests._test_extract_with_targetcCs4t}||Wdn1s&0YdSr)r rr5extdirrrrtest_extract_with_targetgsz%ExtractTests.test_extract_with_targetcCs:t }|t|Wdn1s,0YdSr)r rrrrrrr!test_extract_with_target_pathlikeksz.ExtractTests.test_extract_with_target_pathlikec Cst|ttd~}|tD]`\}}tj t |}t |d$}| | |Wdn1sx0Yt|q*Wdn1s0YWdn1s0YdSr)r rr@rAr extractallrrrr*rr2rSrrTr )r5rDrroutfilerrrrtest_extract_allos  2zExtractTests.test_extract_allc Cs|ttd|}||tD]\\}}tj||}t |d$}| | | Wdn1sn0Yt |q$Wdn1s0Yt tdSr)rr@rArrrrrr*r2rSrrTr )r5rrDrrrrrrr_test_extract_all_with_target|s   2(z*ExtractTests._test_extract_all_with_targetcCs4t}||Wdn1s&0YdSr)r rrrrrtest_extract_all_with_targetsz)ExtractTests.test_extract_all_with_targetcCs:t }|t|Wdn1s,0YdSr)r rrrrrrr%test_extract_all_with_target_pathlikesz2ExtractTests.test_extract_all_with_target_pathlikecCsP|tj|t|d }|||Wdn1sB0YdS)Nr)r\rrisfiler2rSrT)r5rRr#rrrr check_files zExtractTests.check_filecCsBtjj}||ddd||ddd||ddddS) Nz,,?,C:,foo,bar/z,z_,C_,foo,bar/zza\b,ce|f"g?h*iza\b,c_d_e_f_g_h_i../../foo../../ba..r/ foo/ba..r)r@rAZ_sanitize_windows_namerS)r5Zsanrrrtest_sanitize_windows_namesz'ExtractTests.test_sanitize_windows_namecCsgd}||dS)N))z ../foo/barfoo/bar)z foo/../barr)z foo/../../barr)z foo/bar/..r)z ./../foo/barr)z/foo/barr)z /foo/../barr)z/foo/../../barr_test_extract_hackers_arcnames)r5Zcommon_hacknamesrrr*test_extract_hackers_arcnames_common_casess z7ExtractTests.test_extract_hackers_arcnames_common_cases\zRequires \ as path separator.cCsgd}||dS)N))z ..\foo\barr)z ..\/foo\/barr)z foo/\..\/barr)z foo\/../\barr)z C:foo/barr)z C:/foo/barr)z C://foo/barr)z C:\foo\barr)z//conky/mountpoint/foo/barr)z\\conky\mountpoint\foo\barr)z///conky/mountpoint/foo/barconky/mountpoint/foo/bar)z\\\conky\mountpoint\foo\barr)z//conky//mountpoint/foo/barr)z\\conky\\mountpoint\foo\barr)z//?/C:/foo/barr)z\\?\C:\foo\barr)zC:/../C:/foo/barz C_/foo/bar)za:b\ce|f"g?h*izb/c_d_e_f_g_h_i)rrr)r5Zwindows_hacknamesrrr*test_extract_hackers_arcnames_windows_onlysz7ExtractTests.test_extract_hackers_arcnames_windows_onlyrzRequires / as path separator.cCsgd}||dS)N))z //foo/barr)rz foo../ba..r) foo/..\barrr)r5Zposix_hacknamesrrr(test_extract_hackers_arcnames_posix_onlysz5ExtractTests.test_extract_hackers_arcnames_posix_onlyc Cs>|D]2\}}d|}ttdtj0}t}||_d|_|||Wdn1s`0Y| t j d}t j ddd}t j j |g|dR}ttd6}|||} |j| |d || |fd Wdn1s0Y|||tdttd}||Wdn1s60Y|||tdt j j t g|dR}ttd.}||} |j| |d |d Wdn1s0Y|||t|dd ttd}|Wdn1s0Y|||t|dd ttqdS) Nfoobarr:rrrsubdirZsubsubrGzextract %r: %r != %r)msgz extract %rr)rr@rArrZipInforRrrBreplacerrorr*r[rrSrr rrr ) r5Z hacknamesZarcnameZ fixednamer#rDr targetpathrrrrrrsH * $ *  & ( z+ExtractTests._test_extract_hackers_arcnamesN)rrrrrrrrrrrrrrrunittestZskipIfrrrorrrrrrrr:s"    rc@sPeZdZddZddZddZddZd d Zed d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Z d;d<Z!d=d>Z"d?d@Z#dAdBZ$dCdDZ%dEdFZ&dGdHZ'dIdJZ(e)dKdLZ*dMdNZ+dOS)P OtherTestsc CsBttdtjh}|dd|t|ddWdn1sJ0Y||dgdWdn1s~0Yttd}| }d}|D]:}| |}|| 7}Wdq1s0Yq| |dd hd}|D]}|| |7}q| |dd hWdn1s40YdS) Nr:r_rbarrrGr&rsbarfoo) r@rArrrBrrrSr`rar2rTrZ)r5rDrlr+rnrrrrtest_open_via_zip_infos   *4 ,z!OtherTests.test_open_via_zip_infocCs^ttd>}dD](}t|}|jdO_|||qWdn1sP0YdS)Nr:Zabcdefghijklmnopr/)r@rArr flag_bitsrB)r5Zorig_zipr+rrrr-test_writestr_extended_local_header_issue1202s  z8OtherTests.test_writestr_extended_local_header_issue1202cCsttd8}tD]"\}}|||||jdqWdn1sJ0Y||jdttd}||jdWdn1s0Y||jddS)Nr:zzipfp is not openzipfp is not closedrG)r@rArrrBZassertIsNotNoner6 assertIsNonerrrr test_closes  .,zOtherTests.test_closecCsttd*}tD]\}}|||qWdn1s<0Yz8ttd}tWdn1sr0YWn"tjy||jdYn0dS)Nr:rGr)r@rArrrBr>rr6)r5rDrrZzipfp2rrrtest_close_on_exception"s ,*z"OtherTests.test_close_on_exceptioncCs d}|ttjt|ddS)NsdPKx!p@xPKxx!p@xPK/rG)rNotImplementedErrorr@rArrrrrrtest_unsupported_version/s  z#OtherTests.test_unsupported_versioncCsRtd}t|,}|D]}||qWdn1sD0YdS)Nzzip_cp437_header.zip)rr@rAr`r2r)r5rrDr_rrrtest_read_unicode_filenames:s  z&OtherTests.test_read_unicode_filenamescCsttd>}|dd|dd||djtWdn1sP0Yttd8}||j djd||j djdWdn1s0YdS)Nr:foo.txtzTest for unicode filenameuö.txtrrGrM) r@rArrBrrarRr_rSfilelist)r5rHrrrtest_write_unicode_filenamesBs  4z'OtherTests.test_write_unicode_filenamescCsNttd.}|dd||ddWdn1s@0YdS)Nr:uприкладssample)r@rArrBrSrTrrrr'test_read_after_write_unicode_filenamesLs z2OtherTests.test_read_after_write_unicode_filenamescCsttd}d}ttdtj}|||Wdn1sB0Y|t ttdtjWdn1s|0Yttd4}|| |g|| ||Wdn1s0YdS)N testfile.txt#hello, world. this is some content.xrG) r rr@rArrBrFileExistsErrorrSr`rT)r5rRr#rDrrrtest_exclusive_create_zip_fileQs* .z)OtherTests.test_exclusive_create_zip_filecCstjtrttd}d}z)r5r6rHrrrtest_close_erroneous_fileps  (z$OtherTests.test_close_erroneous_filecCsttd}|dWdn1s*0Y|tt|tttttd }|t|Wdn1s0Yt }|d|t|| dd|t|dS)Nr:rrsthis is not a legal zip file r) r2rr3rr@ is_zipfilerrrrrr4rrrtest_is_zip_erroneous_files ( .  z%OtherTests.test_is_zip_erroneous_filecCst}tj|dd}|ddWdn1s80Y|}tt|D](}t|d|}|tj tj|qVdS)Nr:r>rO, for a Muse of Fire!) rrr@rArBrWr'rYrr>)r5r6rrNrrrtest_damaged_zipfiles*zOtherTests.test_damaged_zipfilecCstjtdd}|ddWdn1s00Y|ttttd4}|t||dd|}Wdn1s0Yt }| ||t||dd|t|dS)Nr:r>rrrr) r@rArrBr\rr2rrTrrr3)r5rr6Z zip_contentsrrrtest_is_zip_valid_files*  &  z!OtherTests.test_is_zip_valid_filecCs|ttjtdSr)rrr@rArrrrr%test_non_existent_file_raises_OSErrors z0OtherTests.test_non_existent_file_raises_OSErrorcCsnttd}||tjtjtttd}|dWdn1sN0Y|tjtjtdS)Nr:z short file)r2rrrr@r>rAr3)r5rr6rrr!test_empty_file_raises_BadZipFiles   (z,OtherTests.test_empty_file_raises_BadZipFilecCst}tj|dd}|ddWdn1s80Y|t|jd|t|jd|t|j |t|jddtt d}| dWdn1s0Y|t|j t dS)Nr:r>rO, for a Muse of Fire!z bogus.txtrzzipfile test data) rrr@rArBrrrTr2rdrr3)r5r+rrrrr!test_closed_zip_raises_ValueErrors* (z,OtherTests.test_closed_zip_raises_ValueErrorcCs|ttjtddS)NrV)rrr@rArrrrrtest_bad_constructor_modesz$OtherTests.test_bad_constructor_modecCstjtdd}|ddWdn1s00YtjtddP}|d|t|jdd|t|jdd|t|jddWdn1s0YdS) Nr:r>rrrGrVUZrU)r@rArrBrTrrr2r5rrrrtest_bad_open_modes* zOtherTests.test_bad_open_modec Cstjtddv}|dd|d@}ttD]}||ddq0||dWdn1sl0YWdn1s0YdS)Nr:r>rrrr&r) r@rArrBr2r'r(rSrT)r5rrr$rrr test_read0s    zOtherTests.test_read0cCsDtjtdd"}|t|jddWdn1s60YdS)Nr:r>rrG)r@rArrKeyErrorr2rrrrtest_open_non_existent_itemsz&OtherTests.test_open_non_existent_itemcCs|ttjtdddS)Nr:r)rrr@rArrrrrtest_bad_compression_modesz$OtherTests.test_bad_compression_modecCsJd}tt|d }|t|jdWdn1s<0YdS)NsfPK.C@xPK..C@xPK/!rGr)r@rArrrrr2)r5r+rrrrtest_unsupported_compressionsz'OtherTests.test_unsupported_compressioncCsPtjtdd.}|dd||dgWdn1sB0YdS)Nr:r>z foo.txtqqqrr)r@rArrBrSr`rrrrtest_null_byte_in_filenames z%OtherTests.test_null_byte_in_filenamecCs<|tjd|tjd|tjd|tjddS)N.8r)rSr@ZsizeEndCentDirZsizeCentralDirZsizeEndCentDir64ZsizeEndCentDir64Locatorrrrrtest_struct_sizesszOtherTests.test_struct_sizesc Cstjtdd*}||jd|ddWdn1s>0Ytjtdd}||jdWdn1sz0Yd}tjtdd"}||_|ddWdn1s0Ytjtdd}||j|Wdn1s0Ydd d td D}|d }tjtdd"}||_|ddWdn1s^0Ytjtdd}||j|Wdn1s0YtjtddR}| t |d |_Wdn1s0Y|ddWdn1s0Ytjtdd}||j|Wdn1sL0Ytjtdd"}d|_|ddWdn1s0Ytjtdd}d|_Wdn1s0Ytjtdd}||jdWdn1s0Ytjtdd"}d|_|ddWdn1sD0Yt j t}tjtdd}d|_Wdn1s0Y||t j tktjtdd}||jdWdn1s0YdS)Nr:r>r&rrrGs9Bravely taking to his feet, he beat a very brave retreat.cSsg|]}d|ddqS)rrrrr"rrrr%0r&z,OtherTests.test_comments..r soopssoriginal commentrsan updated commentsoriginal comment that's longersshorter comment)r@rArrSrrBr*r'rrrrrgetsizer\)r5rZzipfrrZcomment2Zoriginal_zip_sizerrr test_commentssP*,*, ,. *,.,&., &zOtherTests.test_commentsc CspttdtjL}|dd|td|_Wdn1sD0YWdn1sb0YdS)Nr:rrzthis is an error)r@rArrrBr TypeErrorrrrrrtest_unicode_commentVs  zOtherTests.test_unicode_commentcCsttdtj"}||jd|_Wdn1s80Yttd}||jdWdn1sr0YdS)NrrrG)r@rArrrrrrSrrrr$test_change_comment_in_empty_archive\s  $z/OtherTests.test_change_comment_in_empty_archivecCsttdtj}|ddWdn1s20Yttdtj"}||jd|_Wdn1st0Yttd}||jdWdn1s0YdS)Nr:rrrrrG) r@rArrrBr\rrrSrrrr'test_change_comment_in_nonempty_archivecs* $z2OtherTests.test_change_comment_in_nonempty_archivecCstjtdd}|ztjtdd}WntjyF|dYn0tjtdd}|ztjtdd}Wn|dYn0dS)Nr:r>rGz+Unable to create empty ZIP file in 'w' moderz+Unable to create empty ZIP file in 'a' mode)r@rArrr>rrrrrtest_empty_zipfilelszOtherTests.test_empty_zipfilecCs*ttd}||tjtjtddSNr:rG)r2rrrr@r>rArqrrrtest_open_empty_file}s zOtherTests.test_open_empty_filecCs|ttjdddS)NZ seventies)irMrMrrr)rrr@rrrrrtest_create_zipinfo_before_1980sz*OtherTests.test_create_zipinfo_before_1980cCs tjdd}|t|ddS)NemptyrQz&)r@rrSrr5zirrrtest_create_empty_zipinfo_reprs z)OtherTests.test_create_empty_zipinfo_reprcCst}||jd||jd||jd||jtj||jd||j d| |j d||j tj ||jtj ||jd||jd||jd||jd||jd||jd||jddS)NZNoNamerr&)rrr)r@rrSZ orig_filenamerRrrrrr-rZZ create_systemZcreate_versionZDEFAULT_VERSIONZextract_versionZreservedrZvolumeZ internal_attrrrbr;rrrr,test_create_empty_zipinfo_default_attributess"z7OtherTests.test_create_empty_zipinfo_default_attributescCsHd}tt|d}||Wdn1s:0YdS)NsnPK@abcAPK@abcPK3%rG)r@rArrrrdr5rrrrr#test_zipfile_with_short_extra_fields z.OtherTests.test_zipfile_with_short_extra_fieldc Cs~d}d}d}ttdtj}|jddd}||Wdn1sN0Y|jddd.}|t|jdddWdn1s0Y|t|jdd dWdn1s0Y|t|d d Wdn1s0Y|t|t d Wdn1s@0Y|t| Wdn1st0Y||Wdn1s0Y|jd dd}||Wdn1s0YWdn1s0Yttd Z}| | d|| | d|| | d || | gdWdn1sp0YdS)Ns"It's fun to charter an accountant!s And sail the wide accountant seas#To find, explore the funds offshorer:rr>rhandlerGr_ZabcderHbaz)rrr)r@rArrr2r3rrrBrlrrSrTr`)r5Zmsg1Zmsg2Zmsg3rZw2w1rrrtest_open_conflicting_handless2( , , , , (*Jz(OtherTests.test_open_conflicting_handlesc Csd}|d}ttd}|d|Wdn1s<0Yttd}|dd}||tj| | ||| tj | | d||tj | | || | d|||d|dtj | | t||dtj| | dWdn1s20YWdn1sR0Yt}tj|dd}|d|Wdn1s0Ytj|dd}|dd}||tj| | ||| tj | | d||tj | | || | d|||d|dtj | | t||dtj| | dWdn1s0YWdn1s0YdS) NsWhere's Bruce?sBrucer:rrGrrIr>)findr@rArrBr2rrSEEK_SETrSrSEEK_CURrTSEEK_ENDrYrr)r5txtblocrr6r+rrrtest_seek_tellsB *P,zOtherTests.test_seek_tellc Csd}t|}tj|dtjd}|ddWdn1sB0YtddJt| }|t |j dWdn1s0YWdn1s0YdS)NsPKr:)r8raz zipfile.bz2) rrr@rArrBmockZpatchrrr)r5r+Zzip_filerHrrr)test_decompress_without_3rd_party_librarys * z4OtherTests.test_decompress_without_3rd_party_librarycCsttttdSrrrrrrrszOtherTests.tearDownN),rrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrrrrrrrsR          : & rc@seZdZddZddZdS)AbstractBadCrcTestscCsN|j}tjt|dd }|d|Wdn1s@0YdS)NrGr>afile)zip_with_bad_crcr@rArrrSrdr rrrtest_testzip_with_bad_crcsz-AbstractBadCrcTests.test_testzip_with_bad_crcc Csf|j}tjt|dd"}|tj|jdWdn1sB0Ytjt|ddL}|dd }|tj|jWdn1s0YWdn1s0Ytjt|dd}|ddR}d|_ |tj|drqWdn1s0YWdn1s80YWdn1sX0YdS)NrGr>rr) rr@rArrrr>rTr2 MIN_READ_SIZE)r5rrZ corrupt_filerrrtest_read_with_bad_crcs0L z*AbstractBadCrcTests.test_read_with_bad_crcN)rrrrr!rrrrrsrc@seZdZejZdZdS)StoredBadCrcTestssxPK ;:r afilehello,AworldPK ;:r afilePK3/N)rrrr@rr8rrrrrr"$sr"c@seZdZejZdZdS)DeflateBadCrcTestss|PKn} =FAKEnafileHW(/Iɠ=PKn} =FAKEnafilePK33N)rrrr@r r8rrrrrr#0sr#c@seZdZejZdZdS)Bzip2BadCrcTestssPK nu =FAKE8nafileBZh91AY&SYԨ@D P!u5:"(HjTe?PK nu =FAKE8n afilePK3[N)rrrr@rr8rrrrrr$=sr$c@seZdZejZdZdS)LzmaBadCrcTestssPKnu =FAKEnafile ]4I:3` q!.8PKnu =FAKEn afilePK3>N)rrrr@rr8rrrrrr%Msr%c@sZeZdZdZdZdZdZddZddZd d Z d d Z e d dZ ddZ ddZdS)DecryptionTestssPKni.#y?&test.txtgly|-=yrZ}Lg|䋺)lPKni.#y?& test.txtPK6LsPK }38xuzeroUT ֋GڋGUx.)rr*r'r+)r-Z datacountrrrr.s z-AbstractTestsWithRandomBinaryFiles.setUpClasscCs:ttd}||jWdn1s,0YdSr/r1r4rrrr7s z(AbstractTestsWithRandomBinaryFiles.setUpcCsttttdSrrrrrrrsz+AbstractTestsWithRandomBinaryFiles.tearDowncCsJt|d|(}|td|ttWdn1s<0YdS)Nr:r;)r@rAr3rr)rrrrFs z4AbstractTestsWithRandomBinaryFiles.make_test_archivecCs|||t|d|R}|t}|t|t|j|||j||d|jWdn1sr0YdS)NrGr;)rFr@rArTrrSrYr+)r5rr8rDtestdatarrrros   z+AbstractTestsWithRandomBinaryFiles.zip_testcCs t|D]}|||jqdSrrprqrrr test_reads z,AbstractTestsWithRandomBinaryFiles.test_readc Cs2|||t|d|}g}|t,}|d}|s>qJ||q.Wdn1s^0Yg}|d,}|d}|sq||qxWdn1s0Yd|} |t | t |j || |j d|} |t | t |j || |j Wdn1s$0YdSrs) rFr@rAr2rrTrur*rSrYr+) r5rr8rDrvrwrxryrzZ testdata1Z testdata2rrrr{s(   *  *  z0AbstractTestsWithRandomBinaryFiles.zip_open_testcCs t|D]}|||jqdSrr|rqrrrr} s z,AbstractTestsWithRandomBinaryFiles.test_openc Cs|||t|d|}g}|t2}|tdd}|sBqN||q,Wdn1sb0Yd|}| t |t |j | ||j Wdn1s0YdSr) rFr@rAr2rrTrrur*rSrYr+)r5rr8rDrvrwrxr8rrrr s  * z7AbstractTestsWithRandomBinaryFiles.zip_random_open_testcCs t|D]}|||jqdSrrrqrrrr s z3AbstractTestsWithRandomBinaryFiles.test_random_openN)rrrrr.r7rrFror9r{r}rrrrrrr5s  r5c@seZdZejZdS) StoredTestsWithRandomBinaryFilesNrYrrrrr: sr:c@seZdZejZdS)!DeflateTestsWithRandomBinaryFilesNrKrrrrr;" sr;c@seZdZejZdS)Bzip2TestsWithRandomBinaryFilesNr rrrrr<' sr<c@seZdZejZdS)LzmaTestsWithRandomBinaryFilesNrrrrrr=, sr=c@s,eZdZddZddZddZddZd S) TellablecCs||_d|_dSNr)r6offsetr4rrr__init__4 szTellable.__init__cCs|j|}|j|7_|Sr)r6r3r@)r5r+nrrrr38 s zTellable.writecCs|jSr)r@rrrrr= sz Tellable.tellcCs|jdSrr6flushrrrrrD@ szTellable.flushN)rrrrAr3rrDrrrrr>3 sr>c@s$eZdZddZddZddZdS) UnseekablecCs ||_dSr)r6r4rrrrAD szUnseekable.__init__cCs |j|Sr)r6r3rrrrr3G szUnseekable.writecCs|jdSrrCrrrrrDJ szUnseekable.flushN)rrrrAr3rDrrrrrEC srEc@s$eZdZddZddZddZdS)UnseekableTestsc CspddttfD]Z}|j|d6t}|dt|}t||dtj (}| dd| dd Wdn1s0Y| | dd d tj|d d }| d }| |dWdn1s0Y| d }| |d Wdn1s 0YWdn1s@0YWdq1s`0YqdS)NcSs|Srrrrrrr~O r&z/UnseekableTests.test_writestr..wrapperabcr:ones111twos222rIabcPKrGr>)r>rEsubTestrrr3BufferedWriterr@rArrBrSrWr2rT)r5rIrbfrDrzopenrrr test_writestrN s   * . zUnseekableTests.test_writestrc CsddttfD]}|j|dt}|dt|}t||dtj }| t t t t d}|dWdn1s0Y|t dt t d}|d Wdn1s0Y|t d Wdn1s0Y||dd d tj|d d}| d }||dWdn1sZ0Y| d  }||d Wdn1s0YWdn1s0YWdq1s0YqdS)NcSs|SrrrGrrrr~_ r&z,UnseekableTests.test_write..rHrJr:r0rLrKrNrMrIrOrGr>)r>rErPrrr3rQr@rAr addCleanupr rr2rSrWrT)r5rIrrRrDf2rrSrrr test_write^ s&    (  (* 0 zUnseekableTests.test_writec CsnddttfD]X}|j|d4t}|dt|}t||dtj |}| dd}|dWdn1s0Y| dd}|d Wdn1s0YWdn1s0Y| | dd d t|4}| | dd| | dd Wdn1s>0YWdq1s^0YqdS) NcSs|SrrrGrrrr~t r&z1UnseekableTests.test_open_write..rHrJr:rKrLrMrNrIrO)r>rErPrrr3rQr@rArr2rSrWrT)r5rIrrRrrSrrrtest_open_writes s  (F zUnseekableTests.test_open_writeN)rrrrTrWrXrrrrrFM srFc@sheZdZeddZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ddZdS)TestsWithMultipleOpenscCs dtd|_dtd|_dS)NrL'rN)rdata1r'r,rrrr. sz!TestsWithMultipleOpens.setUpClasscCsPt|dtj,}|d|j|d|jWdn1sB0YdS)Nr:rKrM)r@rAr rBr[r')r5rrDrrrrF sz(TestsWithMultipleOpens.make_test_archivec Cst|D]}||tj|dd}|df}|d<}|d}|d}||7}||7}Wdn1s~0YWdn1s0Y||||||jWdq1s0YqdS)NrGr>rK)rrFr@rAr2rTrSr[r5rrzopen1zopen2r[r'rrrtest_same_file s     H z%TestsWithMultipleOpens.test_same_filec Cst|D]}||tj|dd}|df}|d<}|d}|d}||7}||7}Wdn1s~0YWdn1s0Y|||j|||jWdq1s0YqdS)NrGr>rKrMr\ rrFr@rAr2rTrSr[r'r]rrrtest_different_file s     Hz*TestsWithMultipleOpens.test_different_filec Cst|D]}||tj|dd}|df}|d}|d2}|d}||7}||7}Wdn1s~0YWdn1s0Y|||j|||jWdq1s0YqdS)NrGr>rKr\rMra)r5rrr^r[r_r'rrrtest_interleaved s       Hz'TestsWithMultipleOpens.test_interleavedc Cst|D]}||t}t|d0}||d}||d}Wdn1sb0Y|d}|d}||7}||7}Wdn1s0Y| ||j | ||j qdS)NrGrKrMr\) rrF contextlib ExitStackr@rA enter_contextr2rTrSr[r')r5rstackrr^r_r[r'rrrtest_read_after_close s   .   *z,TestsWithMultipleOpens.test_read_after_closec Cst|D]}t|dtj`}|d|j|d|j|d}|d}Wdn1sd0YWdn1s0Y| ||jddt|d$}|d}|d}Wdn1s0Y| ||j| ||jqdS)Nr:rKrMr\rG) rr@rAr rBr[r'r2rTrSr5rrr^r[r'rrrtest_read_after_write s  F (z,TestsWithMultipleOpens.test_read_after_writec Cst|D]}t|dtj`}|d|j|d(}|d|d|jWdn1sd0YWdn1s0Yt|d$}|d}|d}Wdn1s0Y| ||j| ||jqdS)Nr:rKr\rMrG) rr@rAr rBr[r2rTr'rSrirrrtest_write_after_read s   J (z,TestsWithMultipleOpens.test_write_after_readc Cs|ttjtddR}tdD]8}|d|d}Wdq"1sP0Yq"Wdn1sp0Yttj }| | dWdn1s0YdS)NrGr>rrK) rFrr@rAr'rTr2rdevnullZ assertLessfileno)r5rrr^rrrrtest_many_opens s    > z&TestsWithMultipleOpens.test_many_opensc Cs:ttdtj}|d|jWdn1s40Yttdtj}|dd^}|d}|dd}||j Wdn1s0Y||7}Wdn1s0YWdn1s0Y| ||jtt$}| |d|j Wdn1s,0YdS)Nr:rKrrGr\rM) r@rArr rBr[r2rTr3r'rS)r5rZr1r[rrrrtest_write_while_reading s, *H z/TestsWithMultipleOpens.test_write_while_readingcCs ttdSrrOrrrrr szTestsWithMultipleOpens.tearDownN)rrrrr.rFr`rbrcrhrjrkrnrorrrrrrY s    rYc@s<eZdZddZddZddZddZd d Zd d Zd S)TestWithDirectorycCsttdSr)rrrrrrrr7 szTestWithDirectory.setUpc Csttd}|tWdn1s.0Y|tjtj td|tjtj tdd|tj tj tddddS)N zipdir.ziprbrG) r@rArrrr\rrisdirr*rrrrrtest_extract_dir s (z"TestWithDirectory.test_extract_dircCs ttjtd|dSNr)rrrr*rrtrrrr test_bug_6050 szTestWithDirectory.test_bug_6050c Cstjtd}t|t|jd@}tt d}| ||j d}| |j d||j|d>dB| |d|j d}| |j d ||j|d>dBWdn1s0Ytt d }|j d}| |j d||j|d>dB|j d}| |j d ||j|d>dBtjtd }t|||| tjtj|d|tt|d Wdn1s0YdS) Nrrr:rz/x/r6yrMzy/rGrr)rrr*rrrst_moder@rArr3rr\rRrnrSrrrsrYlistdir)r5dirpathr?rrrrrrtest_write_dir s0     4    z TestWithDirectory.test_write_dirc Cs ttjtdttdB}|dd|j d}| |j d| |j dWdn1sh0Yttd}|j d}| |j d| |j dtjtd}t|||| tjtj|d| t|dgWdn1s0YdS) Nrr:zx/r&riArGr)rrrr*rr@rArrBrrSrRrr\rnrrsry)r5rrrrrrtest_writestr_dir, s  ,   z#TestWithDirectory.test_writestr_dircCs tttjtrttdSr)r rrrrrr rrrrr= s zTestWithDirectory.tearDownN) rrrr7rtrvr{r|rrrrrrp s rpc@s4eZdZddZddZddZddZd d Zd S) ZipInfoTestscCsHtjt}|t|jd|| ||j t j tdSNztest_zipfile.py)r@r from_filerlrS posixpathrvrRris_dirrbrrrrrrrtest_from_fileD s zZipInfoTests.test_from_filecCsNtjtt}|t|j d| | ||j t jtdSr~)r@rrrrrlrSrrvrRrrrbrrrrrrrtest_from_file_pathlikeJ sz$ZipInfoTests.test_from_file_pathlikecCsPtjttd}|t|j d| | ||j tj tdS)Nr)r@rrrfsencoderlrSrrvrRrrrbrrrrrrtest_from_file_bytesP sz!ZipInfoTests.test_from_file_bytescCsxttdZ}tj|d}|t|j d| | ||j t jtWdn1sj0YdS)Nrr)r2rlr@rrrmrSrrvrRrrrbrrr)r5rr rrrtest_from_file_filenoV s  z"ZipInfoTests.test_from_file_filenocCs`tjtjt}tj|d}||j d| | ||j tj ||jddS)NZ stdlib_testsz stdlib_tests/r)rrrkabspathrlr@rrrSrRr\rrrrb)r5rzr rrr test_from_dir] s zZipInfoTests.test_from_dirN)rrrrrrrrrrrrr}C s r}c@sJeZdZddZddZddZddZd d Zed d Z d dZ dS)CommandLineTestcOs2tjddg|Ri|\}}}|tjdS)N-mr@r)rZassert_python_okrrlinesepr)r5argsrCrcouterrrrr zipfilecmdh s zCommandLineTest.zipfilecmdcGstjddg|RS)Nrr@)rZassert_python_failure)r5rrrrzipfilecmd_failurem sz"CommandLineTest.zipfilecmd_failurecCs||\}}}||d|d||d||d||dd\}}}||d||ddS)Nr&susageserrorsrequired-lr)rrSrZr@ZassertNotEqualstrip)r5rrrrrr test_bad_usep s  zCommandLineTest.test_bad_usecCsXtd}dD] }|||}||dq td}|d|\}}}||ddS)Nrq)-tz--tests Done testingz testtar.tarrr&)rrrSrstripr)r5zip_nameoptrrrrrrtest_test_commandz s z!CommandLineTest.test_test_commandcCstd}t}t|d}||Wdn1s<0Y|dd}dD] }|j||dd}| ||qZdS)NrqrGr backslashreplace)rz--listzascii:backslashreplace)ZPYTHONIOENCODING) rrrUr@rArVrWrrrS)r5rrxZtfZexpectedrrrrrtest_list_command s(z!CommandLineTest.test_list_commandc Cs\|ttttd}|dWdn1s60Ytt|ttttj tdd}|dWdn1s0Yttg}ttdtdg}dD]}z|j |t g|R}| |dtt L}| ||| ||d d | ||d d Wdn1s60YWtt qtt 0qdS) Nr:ztest 1zfile.txtztest 2rz /file.txt)z-cz--creater&rstest 1rstest 2)rUr rr2r3rr TESTFNDIRr rr*rrrSr@rAr`rT)r5rfilesr`rrrHrrrtest_create_command s$  (  (  8z#CommandLineTest.test_create_commandc Cstd}dD]}t}||||}||dt|}|D]}tj ||j dtj }| r|tj|qH|tj|t|d&}||||WdqH1s0YqHWdn1s0YWdq 1s 0Yq dS)Nrq)z-ez --extractr&rr)rr rrSr@rArarrr*rRrrorr\rsrr2rT) r5rrrrrHr rrrrrtest_extract_command s     z$CommandLineTest.test_extract_commandN) rrrrrrrrr rrrrrrrf s    rc@seZdZddZddZddZddZee j d ee d e j d d d Zee j d ee d e j d ddZdS)TestExecutablePrependedZipcCs tddd|_tddd|_dS)NZ exe_with_zipZ ziptestdata)rZ exe_with_z64)rexe_zip exe_zip64rrrrr7 sz TestExecutablePrependedZip.setUpcCsj|t|d|t|4}|D]}||}|d|q,Wdn1s\0YdS)Nzis_zipfile failed on sFAVORITE_NUMBER)r\r@rrAr`rTrZ)r5r_rDrBr+rrr_test_zip_works s    z*TestExecutablePrependedZip._test_zip_workscCs||jdSr)rrrrrr test_read_zip_with_exe_prepended sz;TestExecutablePrependedZip.test_read_zip_with_exe_prependedcCs||jdSr)rrrrrr"test_read_zip64_with_exe_prepended sz=TestExecutablePrependedZip.test_read_zip64_with_exe_prependedzsys.executable required.z /bin/bashz#Test relies on #!/bin/bash working.cCs"t|jtjg}|d|dSNsnumber in executable: 5) subprocess check_outputrsys executablerZr5outputrrrtest_execute_zip2 sz,TestExecutablePrependedZip.test_execute_zip2cCs"t|jtjg}|d|dSr)rrrrrrZrrrrtest_execute_zip64 sz-TestExecutablePrependedZip.test_execute_zip64N)rrrr7rrrrZ skipUnlessrrrraX_OKrrrrrrr s    rc@seZdZGdddZdS)jaracoc@seZdZGdddZdS)zjaraco.itertoolsc@s$eZdZddZddZddZdS)zjaraco.itertools.CountercCsd|_t||_dSr?)riter _orig_iter)r5r$rrrrA sz!jaraco.itertools.Counter.__init__cCs|Srrrrrr__iter__ sz!jaraco.itertools.Counter.__iter__cCst|j}|jd7_|Sr)nextrr)r5resultrrr__next__ s z!jaraco.itertools.Counter.__next__N)rrrrArrrrrrCounter srN)rrrrrrrrrC srCN)rrrrCrrrrr srcCs&tj|D]}||dq|S)Nr&)r@ CompleteDirs _implied_dirsr`rB)rHr_rrradd_dirs srcCsZt}t|d}|dd|dd|dd|dd |d d d |_|S) Nr:rs content of azb/c.txts content of cz b/d/e.txts content of ezb/f.txts content of fz g/h/i.txts content of iz alpharep.zip)rrr@rArBrR)r+rHrrrbuild_alpharep_fixture s      rc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdZd d!Zd"d#Zd$d%Zd&S)'TestPathcCst|_||jjdSr)rdrefixturesrUrrrrrr7 s zTestPath.setUpccsh|tVWdn1s&0Y|ttVWdn1sZ0YdSr)rPrrrrrrzipfile_alpharep$ s & zTestPath.zipfile_alpharepc cs|t|jt}|D]Z}|j}|||j}| d}| | Wdn1sf0Y|VqdSr/) rrrrfr rr6rrRr2r3rW)r5Ztmpdiralpharepbufferrstrmrrrzipfile_ondisk* s   ,zTestPath.zipfile_ondiskc CsV|D]H}t|}|\}}}|\}}}|\} |\} | \} qdSrrr@riterdir) r5rrootrrrgrGrrrAhr$rrrtest_iterdir_and_types4 s     zTestPath.test_iterdir_and_typescCs|D]}t|}qdSrrr@rr5rrrrrtest_subdir_is_dirD s  zTestPath.test_subdir_is_dirc CsZ|D]L}t|}|\}}}|}|}Wdq1sJ0YqdSr)rr@rrr2rT)r5rrrrrrrr+rrrr}L s    &zTestPath.test_opencCs*|D]}t|}|\}}}qdSrr)r5rrrrrrrrrr9T s  zTestPath.test_readcCs<|D].}t|}|d}|ddd}qdSNrrrrze.txt)rr@rjoinpathr5rrrrArrr test_joinpath[ s    zTestPath.test_joinpathcCs4|D]&}t|}|d}|ddd}qdSrrrrrrtest_traverse_truedivc s   zTestPath.test_traverse_truedivcCs*|D]}tt|}t|qdSr)rrrr_r@)r5rZpathlikerrrtest_pathlike_constructionk s z#TestPath.test_pathlike_constructioncCs*|D]}t|}|tdqdSru)rr@rrrrrrtest_traverse_pathlikes s  zTestPath.test_traverse_pathlikecCs|D]}t|}qdSrrrrrr test_parentx s  zTestPath.test_parentcCs|D]}t|}qdSrrrrrrtest_dir_parent~ s  zTestPath.test_dir_parentcCs|D]}t|}qdSrrrrrrtest_missing_dir_parent s  z TestPath.test_missing_dir_parentcCsP|D]B}t|}|\}}}|dd|dd|d\}qdS)Nrrz bar/baz.txtrr)rr@rrrB)r5rrrrrrrrrrtest_mutability s    zTestPath.test_mutabilityi cCs@t}t|d}ttt|jD]}|||q$d|_ |Sr) rrr@rAmapr_r'HUGE_ZIPFILE_NUM_ENTRIESrBr?)r5rrHentryrrr huge_zipfile s  zTestPath.huge_zipfilecCs6t|}tj|}|D]}|dq"dS)Nsuffix)r@rrrrCrrr)r5rentriesrrrrtest_joinpath_constant_time s  z$TestPath.test_joinpath_constant_timecCs"ddtdD}tj|dS)NcSs g|]}dtjt|qS)r)r*stringascii_lowercaser_)r#rBrrrr% r&z:TestPath.test_implied_dirs_performance..rZ)r'r@rrrrrrtest_implied_dirs_performance sz&TestPath.test_implied_dirs_performanceN)rrrr7rrrrr}r9rrrrrrrrrrrrrrrrr s&   r__main__)WrTrdimportlib.utilrrrrCrrrrrrrr]rZ unittest.mockrr@tempfilerrrrZ test.supportrrrr r r r r rrrrrr(Z DATAFILES_DIRrrrZTestCaserrr rrr'rJrLrMrNrXrZr[r\r]rrrr"r#r$r%r&r5r:r;r<r=r>rErFrYrpr}rrtupleZconsumerrrrrmainrrrrs   0  C       "BA  g[     7}A#P' $