Ϫf?vdZddlmZddlZddlZddlmZddlmZddl m Z m Z ddl m Z d dZGd d e Zy) z0 Test cases covering L{twisted.python.zippath}. ) annotationsN)Union)_coerceToFilesystemEncoding) ZipArchiveZipPath)AbstractFilePathTestsctd|}td|}tj|d5}tj|D]n\}}}|D]c}tj j ||} tj j ||t|dzd} |j| | ep dddy#1swYyxYw)zI Create a zipfile on zfname, containing the contents of dirname' wN) rzipfileZipFileoswalkpathjoinlenwrite) dirnamezfnamecoercedDirname coercedZfnamezfrootignoredfilesfnamefspatharcpaths B/usr/lib/python3/dist-packages/twisted/python/test/test_zippath.pyzipitr!s1W=N/F;M  , * WW^ $  *    *dE2'',,tU3CL14D4FG) *  * * * *s BCC cNeZdZUdZded<ded<d dZd dZd dZd dZd d Z y ) ZipFilePathTestszk Test various L{ZipPath} path manipulations as well as reprs for L{ZipPath} and L{ZipArchive}. zZipArchive[bytes]rrctj|t|j|jdzt d|j|_t |jdz|_|j|_|jDcgc]+}|j|j|jdz-c}|_ ycc}w)Ns.zipr ) rsetUpr!cmnr nativecmnrrrallreplace)selfxs r r%zZipFilePathTests.setUp.s##D) dhh7*+4RBtxx'12 II EIXXNAIIdhh7(:;NNs0C c|j|jjdjd|jjdy)zF L{ZipPath.sibling} returns a path at the same level. onetwoN) assertEqualrchildsibling)r*s r test_siblingzZipFilePathTests.test_sibling6s: /77> PU@VWc|jjd}djtjj |j dztj zdz}|jt|||j jtjtj zdddz}t|}|jd}|jt||y)z Make sure that invoking ZipPath's repr prints the correct class name and an absolute path to the zip file. fooz ZipPath({!r}).zipr r N) rr0formatrabspathr'sepr/reprr)getcwdr)r*r0pathReprrelativeCommonrelpaths r test_zipPathReprz!ZipFilePathTests.test_zipPathRepr<s @Dyyu?U")) GGOODNNV3bffs r test_zipArchiveReprz$ZipFilePathTests.test_zipArchiveRepr]s $..612%,,RWW__T^^f=T-UV dX.// bff0Db!LvU^, g1r3N)returnNone) __name__ __module__ __qualname____doc____annotations__r%r2r?rCrEr3r r#r#%s0  OX 0* 02r3r#)r str | bytesrrNrFrG)rK __future__rrr typingrtwisted.python.filepathrtwisted.python.zippathrrtwisted.test.test_pathsrr!r#rMr3r rTs5# ?69*&H2,H2r3