PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  ]c @s0ddlZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z m Z ddlmZmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lmZm Z m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'm(Z(ddl)m*Z*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3e-j4rddl5m6Z6nde7fdYZ6yddl8Z8Wne9k rdZ8nXdNZ;e<ed!Z=de7fd"YZ>de?fd#YZ@d$ZAd%e7fd&YZBdd'ZCd(ZDeEeEd)d*ZFd+ZGd,ZHd)eEd-ZIdd.ZJd/e7fd0YZKdeKfd1YZLdeLfd2YZMd3eKfd4YZNd5ZOd6ZPd7ZQd8e7fd9YZRd:eKfd;YZSeeEd<ZTe e=d=ZUed>ZVed?ZWed@ZXdAZYdBZZdCZ[dDZ\edEZ]dFZ^dGeKfdHYZ_dIe7fdJYZ`dKeKfdLYZadMZbdS(OiN(tcontextmanager(twraps(tTestCasetskipIft skipUnless(tNodet parseString(tapps(tApps(tUserSettingsHoldertsettings(tmail(tImproperlyConfigured(trequest_started(tDEFAULT_DB_ALIASt connectionst reset_queries(tOptions(tTemplate(tsetting_changedttemplate_rendered(tget_script_prefixtset_script_prefix(tsix(tavailable_attrs(t force_str(t deactivate(tSimpleNamespaceRcBseZRS((t__name__t __module__(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRst Approximatet ContextListtisolate_lru_cachet get_runnertmodify_settingstoverride_settingstrequires_tz_supporttsetup_test_environmenttteardown_test_environmentttzsetcBs&eZddZdZdZRS(icCs||_||_dS(N(tvaltplaces(tselfR(R)((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt__init__3s cCs t|jS(N(treprR((R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt__repr__7scCs6|j|krtStt|j||jdkS(Ni(R(tTruetroundtabsR)(R*tother((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt__eq__:s(RRR+R-R2(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR2s  cBs5eZdZdZddZdZdZRS(skA wrapper that provides direct key access to context items contained in a list of context objects. cCs`t|tjrFx"|D]}||kr||SqWt|ntt|j|SdS(N(t isinstanceRt string_typestKeyErrortsuperRt __getitem__(R*tkeyt subcontext((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR7Ds    cCs*y|j|SWntk r%|SXdS(N(R7R5(R*R8tdefault((s5/usr/lib/python2.7/site-packages/django/test/utils.pytgetMs cCs%y ||Wntk r tSXtS(N(R5tFalseR.(R*R8((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt __contains__Ss   cCsEt}x5|D]-}x$|D]}|t|jO}qWqW|S(s0 Flattened keys of subcontexts. (tsettkeys(R*R?R9tdict((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR?Zs    N(RRt__doc__R7tNoneR;R=R?(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR@s   cCs,tjd|d|d||jj|S(sz An instrumented Template render method, providing a signal that can be intercepted by the test system Client tsenderttemplatetcontext(Rtsendtnodelisttrender(R*RE((s5/usr/lib/python2.7/site-packages/django/test/utils.pytinstrumented_test_renderest _TestStatecBseZRS((RR(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRJnscCsttdrtdn|dkr6tj}nt}|t_tj|_ t tjdgt_tj|_ |t_tj |_ dt_ tj|_tt_gt_tdS(s Perform global pre-test setup, such as installing the instrumented template renderer and setting the email backend to the locmem email backend. t saved_datasxsetup_test_environment() was already called and can't be called again without first calling teardown_test_environment().t testservers-django.core.mail.backends.locmem.EmailBackendN(thasattrRJt RuntimeErrorRBR tDEBUGRRKt ALLOWED_HOSTSt allowed_hoststlisttdebugt EMAIL_BACKENDt email_backendRt_renderttemplate_renderRIR toutboxR(RSRK((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR%rs"             cCsItj}|jt_|jt_|jt_|j t _ t`t ` dS(s Perform any global post-test teardown, such as restoring the original template renderer and restoring the email sending functions. N(RJRKRQR RPRSRORURTRWRRVR RX(RK((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR&s     ic Kst\}}g}x|jD] \} \} } d } x| D]} t| }|j|| | d kf| d kr | } |jjd|d| d|d|jjdijdt |dkr'x:t |D])}|jj d|dd|d|qWq'qAt| jj t| jqAWq"Wx5|jD]'\} }t| jj t|jq<W|rxtD]} t t| _ qtWn|S( s$ Create the test databases. t verbosityt autoclobbertkeepdbt serializetTESTt SERIALIZEitnumberN(t get_unique_databases_and_mirrorstitemsRBRtappendtcreationtcreate_test_dbt settings_dictR;R.tranget clone_test_dbtset_as_test_mirrortforce_debug_cursor(RYt interactiveR[t debug_sqltparalleltkwargsttest_databasestmirrored_aliasest old_namest signaturetdb_nametaliasest first_aliastaliast connectiontindext mirror_alias((s5/usr/lib/python2.7/site-packages/django/test/utils.pytsetup_databasess8    "   #  cCsAg}t}i}xy|D]q\}\}}t}x'|D]} |j|j| gq>W|j|std|n|||tupdateR;t isdisjointR R<tissubsetRbR.(Rnt dependenciestordered_test_databasestresolved_databasestdependencies_maptsigt_Rstall_depsRutchangedtdeferredRqRr((s5/usr/lib/python2.7/site-packages/django/test/utils.pytdependency_ordereds2        cCs,i}i}i}ttjj}xtD]}t|}|jd}|drd|d||taddR;RRat collectionst OrderedDict(RoRnR}t default_sigRuRvt test_settingstitem((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR`s(       ! c Csx|D]w\}}}|r|dkrex:t|D])}|jjd|dd|d|q5Wn|jj|||qqWdS(s/ Destroy all the non-mirror databases. iR_RYR[N(RfRctdestroy_test_db(t old_configRYRlR[Rvtold_nametdestroyRw((s5/usr/lib/python2.7/site-packages/django/test/utils.pytteardown_databases+s   cCs|s|j}n|jd}t|dkrIdj|d }nd}t|iit|d}t||d}|S(Nt.ii(t TEST_RUNNERtsplittlentjoint __import__Rtgetattr(R ttest_runner_classt test_pathttest_module_namet test_modulet test_runner((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR!;s tTestContextDecoratorcBs\eZdZd d dZdZdZdZdZdZ dZ dZ RS( s A base class that can either be used as a context manager during tests or as a test function or unittest.TestCase subclass decorator to perform temporary alterations. `attr_name`: attribute assigned the return value of enable() if used as a class decorator. `kwarg_name`: keyword argument passing the return value of enable() if used as a function decorator. cCs||_||_dS(N(t attr_namet kwarg_name(R*RR((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR+Vs cCs tdS(N(tNotImplementedError(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pytenableZscCs tdS(N(R(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pytdisable]scCs |jS(N(R(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt __enter__`scCs|jdS(N(R(R*texc_typet exc_valuet traceback((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt__exit__cscskt|tr[|j|jfd}fd}||_||_|StddS(Ncs9j}jr+t|j|n|dS(N(RRtsetattr(t inner_selfRE(tdecorated_setUpR*(s5/usr/lib/python2.7/site-packages/django/test/utils.pytsetUpks  cs|jdS(N(R(R(tdecorated_tearDownR*(s5/usr/lib/python2.7/site-packages/django/test/utils.pyttearDownqs s1Can only decorate subclasses of unittest.TestCase(t issubclassRRRt TypeError(R*tclsRR((RRR*s5/usr/lib/python2.7/site-packages/django/test/utils.pytdecorate_classfs    cs.tdtfd}|S(Ntassignedcs9-}jr"||js(Rt childNodes(telement((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt child_textscSs,g|jD]}|jtjkr |^q S(N(RRRt ELEMENT_NODE(RR((s5/usr/lib/python2.7/site-packages/django/test/utils.pytchildrenscs|S(N((R(RR(s5/usr/lib/python2.7/site-packages/django/test/utils.pytnorm_child_text"scSst|jjS(N(R@t attributesRa(R((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt attrs_dict%scs|j|jkrtS||kr2tS||krNtS|}|}t|t|krtSx0t||D]\}}||stSqWtS(N(ttagNameR<RtzipR.(t want_elementt got_elementt want_childrent got_childrentwanttgot(Rt check_elementRR(s5/usr/lib/python2.7/site-packages/django/test/utils.pyR(s  cSs.x'|jD]}|jtjkr |Sq WdS(N(RRRt COMMENT_NODE(tdocumenttnode((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt first_node8ss\ns s%s(tretcompilet strip_quoteststriptreplacet startswithR(RRRtwrappert want_roottgot_root((RRRRRRRs5/usr/lib/python2.7/site-packages/django/test/utils.pyt compare_xml s$      cCsd}d}||rS||rS|jdd!}|jdd!}nA||r||r|jdd!}|jdd!}n||fS(s Strip quotes of doctests output values: >>> strip_quotes("'foo'") "foo" >>> strip_quotes('"foo"') "foo" cSs@|j}t|dko?|d|dko?|ddkS(Niiit"t'(R R (RR(ts((s5/usr/lib/python2.7/site-packages/django/test/utils.pytis_quoted_stringXs cSsP|j}t|dkoO|ddkoO|d|dkoO|ddkS( NiituiiR R (R R (RR(R((s5/usr/lib/python2.7/site-packages/django/test/utils.pytis_quoted_unicode\s iii(R(RRRR((s5/usr/lib/python2.7/site-packages/django/test/utils.pyROs  cCs|itjrdndd6S(NRRR(RtPY3(R((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt str_prefixistCaptureQueriesContextcBsSeZdZdZdZdZdZedZdZ dZ RS(sU Context manager that captures queries executed by the specified connection. cCs ||_dS(N(Rv(R*Rv((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR+qscCs t|jS(N(titertcaptured_queries(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt__iter__tscCs |j|S(N(R(R*Rw((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR7wscCs t|jS(N(RR(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyt__len__zscCs|jj|j|j!S(N(Rvtqueriestinitial_queriest final_queries(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR}scCsJ|jj|_t|j_t|jj|_d|_tj t |S(N( RvRiR.Rt queries_logRRBRR t disconnectR(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRs    cCsE|j|j_tjt|dk r,dSt|jj|_dS(N( RiRvR tconnectRRBRRR(R*RRR((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRs   ( RRRAR+RR7RtpropertyRRR(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRms     tignore_warningscBs#eZdZdZdZRS(cKsY||_d|jks'd|jkr6tj|_n tj|_tt|jdS(Ntmessagetmodule(t ignore_kwargstwarningstfilterwarningst filter_funct simplefilterR6R R+(R*Rm((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR+s   cCs3tj|_|jj|jd|jdS(Ntignore(R$tcatch_warningsRR&R#(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRs cCs|jjtjdS(N(R)Rtsystexc_info(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRs(RRR+RR(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR s  c#sggfd}tj|}t||}t|||z VWdt|||XdS(s Context manager that takes a named logger and the logging level and provides a simple mock-like list of messages received cs-||}jr"||fn|dS(N(Rb(tmsgRRmtcall(tcallst log_kwargs(s5/usr/lib/python2.7/site-packages/django/test/utils.pyt replacements N(tloggingt getLoggerRR(t logger_namet log_levelR/R0tloggertorig((R.R/s5/usr/lib/python2.7/site-packages/django/test/utils.pyt patch_loggers s|This test relies on the ability to run a program in an arbitrary time zone, but your operating system isn't able to do that.cgs4tj}tjj|z dVWd|t_XdS(s5Context manager to temporarily add paths to sys.path.N(R*tpathtextend(tpathst_orig_sys_path((s5/usr/lib/python2.7/site-packages/django/test/utils.pytextend_sys_paths   ccs%|jz dVWd|jXdS(s?Clear the cache of an LRU cache object on entering and exiting.N(t cache_clear(tlru_cache_object((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR s  ccsOtt|}tt|tjztt|VWdtt||XdS(sReturn a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Note: This function and the following ``captured_std*`` are copied from CPython's ``test.support`` module.N(RR*RRtStringIO(t stream_namet orig_stdout((s5/usr/lib/python2.7/site-packages/django/test/utils.pytcaptured_outputs cCs tdS(sCapture the output of sys.stdout: with captured_stdout() as stdout: print("hello") self.assertEqual(stdout.getvalue(), "hello ") tstdout(RB(((s5/usr/lib/python2.7/site-packages/django/test/utils.pytcaptured_stdoutscCs tdS(sCapture the output of sys.stderr: with captured_stderr() as stderr: print("hello", file=sys.stderr) self.assertEqual(stderr.getvalue(), "hello ") tstderr(RB(((s5/usr/lib/python2.7/site-packages/django/test/utils.pytcaptured_stderrscCs tdS(sCapture the input to sys.stdin: with captured_stdin() as stdin: stdin.write('hello ') stdin.seek(0) # call test code that consumes from sys.stdin captured = input() self.assertEqual(captured, "hello") tstdin(RB(((s5/usr/lib/python2.7/site-packages/django/test/utils.pytcaptured_stdins cCsId}x<tjjD]+}t||rt||jqqWdS(s Clear warning registry for all modules. This is required in some tests because of a bug in Python that prevents warnings.simplefilter("always") from always making warnings appear: http://bugs.python.org/issue4180 The bug was fixed in Python 3.4.2. t__warningregistry__N(R*tmodulestvaluesRMRtclear(R8tmod((s5/usr/lib/python2.7/site-packages/django/test/utils.pytreset_warning_registrysc#s5tj}fdt_z dVWd|t_XdS(sM Context manager to temporarily freeze time.time(). This temporarily modifies the time function of the time module. Modules which import the time function directly (e.g. `from time import time`) won't be affected This isn't meant as a public API, but helps reduce some repetitive code in Django's test suite. csS(N(((tt(s5/usr/lib/python2.7/site-packages/django/test/utils.pyt sN(ttime(ROt _real_time((ROs5/usr/lib/python2.7/site-packages/django/test/utils.pyt freeze_times  cCsdttd kd|}tdidd6td6idd6td6itd6d6g|}|S( s Decorator to enable a Jinja2 template engine in addition to the regular Django template engine for a test or skip it if Jinja2 isn't available. sthis test requires jinja2t TEMPLATESs/django.template.backends.django.DjangoTemplatestBACKENDtAPP_DIRSs&django.template.backends.jinja2.Jinja2tkeep_trailing_newlinetOPTIONSN(Rtjinja2RBR#R.(R((s5/usr/lib/python2.7/site-packages/django/test/utils.pytrequire_jinja2's  toverride_script_prefixcBs)eZdZdZdZdZRS(sO Decorator or context manager to temporary override the script prefix. cCs ||_tt|jdS(N(tprefixR6R[R+(R*R\((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR+<s cCst|_t|jdS(N(Rt old_prefixRR\(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR@s cCst|jdS(N(RR](R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRDs(RRRAR+RR(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR[8s  tLoggingCaptureMixincBs eZdZdZdZRS(sn Capture the output from the 'django' logger and store it on the class's logger_output attribute. cCsQtjd|_|jjdj|_tj|_|j|jjd_dS(Ntdjangoi( R1R2R5thandlerststreamt old_streamRR?t logger_output(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRMscCs|j|jjd_dS(Ni(RbR5R`Ra(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRSs(RRRARR(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR^Hs t isolate_appscBs)eZdZdZdZdZRS(s Act as either a decorator or a context manager to register models defined in its wrapped context to an isolated registry. The list of installed apps the isolated registry should contain must be passed as arguments. Two optional keyword arguments can be specified: `attr_name`: attribute assigned the isolated registry if used as a class decorator. `kwarg_name`: keyword argument passing the isolated registry if used as a function decorator. cOs#||_tt|j|dS(N(tinstalled_appsR6RdR+(R*ReRm((s5/usr/lib/python2.7/site-packages/django/test/utils.pyR+hs cCs/tj|_t|j}ttd||S(Nt default_apps(RRftold_appsRReR(R*R((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRls cCsttd|jdS(NRf(RRRg(R*((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRrs(RRRAR+RR(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyRdWs  csfd}|S(s: Decorator to add tags to a test class or method. cst|dt|S(Nttags(RR>(tobj(Rh(s5/usr/lib/python2.7/site-packages/django/test/utils.pyt decoratorzs((RhRj((Rhs5/usr/lib/python2.7/site-packages/django/test/utils.pyttagvs( s Approximates ContextListsisolate_lru_caches get_runnersmodify_settingssoverride_settingssrequires_tz_supportssetup_test_environmentsteardown_test_environment(cRR1RR*RQR$t contextlibRt functoolsRtunittestRRRtxml.dom.minidomRRt django.appsRtdjango.apps.registryRt django.confR R t django.coreR tdjango.core.exceptionsR tdjango.core.signalsR t django.dbRRRtdjango.db.models.optionsRtdjango.templateRtdjango.test.signalsRRt django.urlsRRt django.utilsRtdjango.utils.decoratorsRtdjango.utils.encodingRtdjango.utils.translationRRttypesRtobjectRYt ImportErrorRBt__all__RMt TZ_SUPPORTRRRRRIRJR%R&R<RyRR`RR!RR#R"RR RRRR R7R$R<R RBRDRFRHRNRSRZR[R^RdRk(((s5/usr/lib/python2.7/site-packages/django/test/utils.pyts         %  $ . * - A90 B  $