Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 `”bÛ/ã@sZddlZde_[dZdZddlZddlZddlZddlZddlm Z ddl Z ddl m Z m Z mZmZdd„Zdadadad d „Zejjd d ƒd kr–dnd fZdd„Zdd„Zd.dd„Zdd„Zd/dd„ZGdd„de ƒZGdd„dƒZGdd„deƒZGdd „d eƒZ Gd!d"„d"e j!ƒZ"Gd#d$„d$e j!ƒZ#Gd%d&„d&e j!ƒZ$d0d(d)„Z%d*d+„Z&d,d-„Z'dS)1éNTz3.3.0aProvides support for the test suite. The test suite as a whole, and individual tests, need to share certain support functions. We have to put these in here so they can always be imported, and so that individual tests need to import nothing more than "reportlab.whatever..." )Ú ConfigParser)ÚisCompactDistroÚ __rl_loader__Úrl_isdirÚ asUnicodec CsNy>d}t|dƒ}|jdƒ|jƒtjj|ƒr+szsetOutDir..ZRL_TEST_OUTDIRÚrÚ__main__z2setOutDir should only be called in the main scriptrZreportlab_testNÚtestséÿÿÿÿ)Ú_OUTDIRÚsysÚargvr ÚenvironÚgetÚmakedirsrÚAssertionErrorr ÚdirnameÚgetcwdrZget_rl_tempdirÚ reportlabÚ__path__ÚRL_HOMEÚisabsÚnormpathÚabspathÚjoinÚ testsFolderÚisdirÚinsert)ÚnamerrÚ scriptDirr(ZtopDirrrrÚ setOutDir$sR     r4Z OFFLINE_MOCKÚ1z,http://www.reportlab.com/rsrc/encryption.gifc CsR|tkr6ttjjttjj|ƒƒdƒ� }|jƒSQRXnddlm }||ƒjƒSdS)NÚrbr)Úurlopen) Ú _mockumapr r r r.r/ÚbasenameÚreadÚurllib.requestr7)r2rr7rrrÚ mockUrlReadWs  r<cCsttƒ}|rtjj||ƒ}|S)zêThis works out where to write test output. If running code in a locked down file system, this will be a temp directory; otherwise, the output of 'test_foo.py' will normally be a file called 'test_foo.pdf', next door. )r4Ú__name__r r r.)rrrrrÚ outputfile_sr>rcCs6tj|ƒjjdƒdkr2tdƒ}|tkr2td|ƒdS)Nr=rrz,Logs and output files written to folder "%s")r Ú _getframeÚf_localsr#r>rÚprint)ÚdepthZoutDirrrrÚ printLocationisrCcGs2tjƒ}tjƒ}x|D]}|j|j|ƒƒqW|S)z½sz.GlobDirectoryWalker.__init__..cSs |j|ƒS)N)r)rhÚpfxrrrrj½s)ÚindexÚpatternrVr Úsepr r0ÚstackrPrrrÚ ValueErrorÚlenÚarchiveÚ directoryÚlistÚmapÚfilterÚ_filesÚkeysÚsort)r[rsrmrkrirrrÚ__init__°s   4 zGlobDirectoryWalker.__init__c Cs¶x°y|j|j}|jd|_WnFtk rd|jjƒ|_tj|jƒ|_|j|j|jƒ|_d|_YqXtj j |j|ƒ}tj j |ƒrœtj j |ƒ rœ|jj |ƒtj||jƒr|SqWdS)Nrr)rPrlÚ IndexErrorroÚpoprsr ÚlistdirÚ filterFilesr r.r0ÚislinkrNÚfnmatchrm)r[rlÚfileÚfullnamerrrÚ __getitem__Ás    zGlobDirectoryWalker.__getitem__cCs|S)z/Filter hook, overwrite in subclasses as needed.r)r[rOrPrrrr~ÕszGlobDirectoryWalker.filterFilesN)rg)r=rarbrcrzrƒr~rrrrrf­s rfc@s"eZdZdZddd„Zdd„ZdS) ÚRestrictedGlobDirectoryWalkerz&An restricted directory tree iterator.rgNcCs~tj|||ƒ|dkrg}gj}t|ttfƒrFx(|D] }||ƒq4Wnt|tƒrX||ƒtjdkrrdd„|j Dƒn|j |_ dS)NrJcSsg|]}|jdtjƒ‘qS)rJ)rVr rn)rÚ_rrrrész:RestrictedGlobDirectoryWalker.__init__..) rfrzrNÚ isinstanceÚtuplertÚstrr rnÚ__self__ÚignorePatterns)r[rsrmÚignoreÚipÚprrrrzÞs  z&RestrictedGlobDirectoryWalker.__init__cCsxtj}g}xLt|ƒD]@\}}x6|jD],}|||ƒsF|tjj||ƒ|ƒr$|j|ƒq$WqW|jƒx|D] }||=qfW|S)z9Filters all items from files matching patterns to ignore.)r€Ú enumeraterŠr r r.rNÚreverse)r[rOrPZfnmÚindicesToDeleteÚirr�rrrr~ìs   z)RestrictedGlobDirectoryWalker.filterFiles)rgN)r=rarbrcrzr~rrrrr„Ûs r„c@seZdZdZdd„ZdS)ÚCVSGlobDirectoryWalkerz4An directory tree iterator that checks for CVS data.cCsntjj}t|ƒ}|rjg}x4tt|ƒƒD]$}||}|||ƒ|kr&|j|ƒq&W|jƒx|D] }||=q\W|S)zçFilters files not listed in CVS subfolder. This will look in the CVS subfolder of 'folder' for a file named 'Entries' and filter all elements from the 'files' list that are not listed in 'Entries'. )r r r.rSÚrangerqrNr�)r[rOrPr.ZcvsFilesr�r‘rrrrr~ÿs  z"CVSGlobDirectoryWalker.filterFilesN)r=rarbrcr~rrrrr’üsr’c@s eZdZdZdd„Zdd„ZdS)ÚSecureTestCaseaýSecure testing base class with additional pre- and postconditions. We try to ensure that each test leaves the environment it has found unchanged after the test is performed, successful or not. Currently we restore sys.path and the working directory, but more of this could be added easily, like removing temporary files or similar things. Use this as a base class replacing unittest.TestCase and call these methods in subclassed versions before doing your own business! cCstjdd…|_tjƒ|_dS)z0Remember sys.path and current working directory.N)r r Ú _initialPathr r'Ú_initialWorkDir)r[rrrÚsetUp'szSecureTestCase.setUpcCs|jt_tj|jƒdS)z0Restore previous sys.path and working directory.N)r•r r r Úchdirr–)r[rrrÚtearDown,szSecureTestCase.tearDownN)r=rarbrcr—r™rrrrr”s r”c@seZdZddd„ZeeƒZdS)Ú NearTestCaseçñh㈵øä>cCslt|ttfƒr0t||ƒ|krhtd||fƒ‚n8x6t||ƒD](\}}t||ƒ|krrCrIrSrTrfr„r’r©r”ršr¥r¶r¹r»rrrrÚs<   0  .! &