https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/test/utils.pyc
�
r�\c@s�ddlmZddlZddlZddlZddlmZddlZddlZddl	m
Z
ddlmZm
Z
ddlmZmZddlmZddlmZdd	lmZdd
lmZddlmZmZmZddlmZdd
lm Z m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)d4Z*dZ+e,ed�Z-de.fd��YZ/de0fd��YZ1d�Z2d�Z3d�Z4d Z5d!�Z6d"�Z7dd#�Z9e:d$�Z;d%�Z<de.fd&��YZ=d'�Z>d(�Z?d)�Z@d*e.fd+��YZAd,e.fd-��YZBd.eBfd/��YZCed0��ZDd1e.fd2��YZEe)e-d3�ZFdS(5i����(tcontextmanagerN(tlocal(twraps(tparseStringtNode(tsettingstUserSettingsHolder(tmail(trequest_started(t
reset_queries(trequest(tTemplatetloadertTemplateDoesNotExist(tcached(ttemplate_renderedtsetting_changed(t	force_str(tsix(t
deactivate(t
skipUnlesstApproximatetContextListt
get_runnertoverride_settingstrequires_tz_supporttsetup_test_environmenttteardown_test_environmentt!_original_template_source_loadersttzsetcBs&eZdd�Zd�Zd�ZRS(icCs||_||_dS(N(tvaltplaces(tselfRR((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__init__#s	cCs
t|j�S(N(treprR(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__repr__'scCs6|j|krtStt|j|�|j�dkS(Ni(RtTruetroundtabsR(R tother((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__eq__*s(t__name__t
__module__R!R#R((((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR"s	cBs)eZdZd�Zd�Zd�ZRS(skA wrapper that provides direct key access to context items contained
    in a list of context objects.
    cCs`t|tj�rFx"|D]}||kr||SqWt|��ntt|�j|�SdS(N(t
isinstanceRtstring_typestKeyErrortsuperRt__getitem__(R tkeyt
subcontext((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR/4s
cCs%y||Wntk
r tSXtS(N(R-tFalseR$(R R0((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__contains__=s

cCsEt�}x5|D]-}x$|D]}|t|j��O}qWqW|S(s0
        Flattened keys of subcontexts.
        (tsettkeys(R R5R1tdict((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR5Ds
	

(R)R*t__doc__R/R3R5(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR0s			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 R:((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytinstrumented_test_renderOscCsVtjt_tt_tjt_dt_tjt	_
dgt_gt_t�dS(s�Perform any global pre-test setup. This involves:

        - Installing the instrumented test renderer
        - Set the email backend to the locmem email backend.
        - Setting the active locale to match the LANGUAGE_CODE setting.
    s-django.core.mail.backends.locmem.EmailBackendt*N(
Rt_rendert_original_renderR>Rt
EMAIL_BACKENDRt_original_email_backendt
ALLOWED_HOSTSR
t_original_allowed_hoststoutboxR(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyRXs			cCs@tjt_t`tjt_t`tjt_	t`t`
dS(s�Perform any global post-test teardown. This involves:

        - Restoring the original test renderer
        - Restoring the email sending functions

    N(RRAR@RRCRRBR
RERDRF(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyRpss�get_warnings_state/restore_warnings_state functions from django.test.utils are deprecated. Use Python's warnings.catch_warnings() context manager instead.cCstjttdd�tjS(sG
    Returns an object containing the state of the warnings module
    t
stackleveli(twarningstwarntwarn_txttDeprecationWarningtfilters(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytget_warnings_state�scCs$tjttdd�|t_dS(sw
    Restores the state of the warnings module when passed an object that was
    returned by get_warnings_state()
    RGiN(RHRIRJRKRL(tstate((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytrestore_warnings_state�scCs�|s|j}n|jd�}t|�dkrIdj|d �}nd}t|iit|d��}t||d�}|S(Nt.ii����(tTEST_RUNNERtsplittlentjoint
__import__Rtgetattr(Rttest_runner_classt	test_pathttest_module_namettest_modulettest_runner((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR�scs�ttt�r"tdt��nd�fd�}|rXtjd�}|f|_n|}ttttj	�|ft_	|S(s
    Changes Django to only find templates from within a dictionary (where each
    key is the template name and each value is the corresponding template
    content to return).

    Use meth:`restore_template_loaders` to restore the original loaders.
    sloader.%s already existscs:y�|d|fSWntk
r5t|��nXdS(s@A custom template loader that loads templates from a dictionary.stest:%sN(R-R
(t
template_namet
template_dirs(ttemplates_dict(s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyttest_template_loader�s
R_N(stest_template_loader(
thasattrRtRESTORE_LOADERS_ATTRt	ExceptiontNoneRtLoadert_cached_loaderstsetattrttemplate_source_loaders(R^tuse_cached_loaderR_ttemplate_loader((R^s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytsetup_test_template_loader�scCs#ttt�t_ttt�dS(sk
    Restores the original template loaders after
    :meth:`setup_test_template_loader` has been run.
    N(RVRRaRgtdelattr(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytrestore_template_loaders�scBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s;
    Acts as either a decorator, or a context manager. If it's a decorator it
    takes a function and returns a wrapped function. If it's a contextmanager
    it's used with the ``with`` statement. In either event entering/exiting
    are called before and after, respectively, the function/block is executed.
    cKs
||_dS(N(toptions(R tkwargs((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR!�scCs|j�dS(N(tenable(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt	__enter__�scCs|j�dS(N(tdisable(R texc_typet	exc_valuet	traceback((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__exit__�scs�ddlm}t�t�r�t�|�s=td��n�j��j���fd�}��fd�}|�_|�_�St����fd��}|S(Ni����(tSimpleTestCasesPOnly subclasses of Django SimpleTestCase can be decorated with override_settingscs�j��|�dS(N(Ro(t	innerself(toriginal_pre_setupR (s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt
_pre_setup�s
cs�|��j�dS(N(Rq(Rw(toriginal_post_teardownR (s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt_post_teardown�s
cs���||�SWdQXdS(N((targsRn(R t	test_func(s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytinner�s(	tdjango.testRvR+ttypet
issubclassRbRyR{R(R R}RvRyR{R~((RzRxR R}s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__call__�s				cCs�ttj�}x-|jj�D]\}}t|||�qWtj|_|t_x?|jj�D].\}}tjdtjj	d|d|�qdWdS(NR8tsettingtvalue(
RRt_wrappedRmtitemsRftwrappedRR;t	__class__(R toverrideR0t	new_value((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyRo�s	cCs^|jt_|`xE|jD]:}tt|d�}tjdtjjd|d|�qWdS(NR8R�R�(	R�RR�RmRVRcRR;R�(R R0R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyRqs(	R)R*R7R!RpRuR�RoRq(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR�s					
cstjd���fd��d��d����fd��d������fd��d�}t||�\}}|jd	d
�}|jd	d
�}|jd�s�d}||}||}n|t|��}|t|��}�||�S(
s0Tries to do a 'xml-comparison' of want and got.  Plain string
    comparison doesn't always work because, for example, attribute
    ordering should not be important. Comment nodes are not considered in the
    comparison.

    Based on http://codespeak.net/svn/lxml/trunk/src/lxml/doctestcompare.py
    s[ \t\n][ \t\n]+cs�jd|�S(Nt (tsub(tv(t_norm_whitespace_re(s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytnorm_whitespacescSs8djg|jD]!}|jtjkr|j^q�S(Nt(RTt
childNodestnodeTypeRt	TEXT_NODEtdata(telementtc((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt
child_textscSs,g|jD]}|jtjkr
|^q
S(N(R�R�RtELEMENT_NODE(R�R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytchildrenscs��|��S(N((R�(R�R�(s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytnorm_child_text#scSst|jj��S(N(R6t
attributesR�(R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt
attrs_dict&scs�|j|jkrtS�|��|�kr2tS�|��|�krNtS�|�}�|�}t|�t|�kr�tSx0t||�D]\}}�||�s�tSq�WtS(N(ttagNameR2RStzipR$(twant_elementtgot_elementt
want_childrentgot_childrentwanttgot(R�t
check_elementR�R�(s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR�)scSs.x'|jD]}|jtjkr
|Sq
WdS(N(R�R�RtCOMMENT_NODE(tdocumenttnode((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt
first_node9ss\ns
s<?xmls<root>%s</root>(tretcompiletstrip_quotestreplacet
startswithR(R�R�R�twrappert	want_roottgot_root((R�R�R�R�R�R�R�s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytcompare_xmls$				

cCs�d�}d�}||�rS||�rS|j�dd!}|j�dd!}nA||�r�||�r�|j�dd!}|j�dd!}n||fS(s�
    Strip quotes of doctests output values:

    >>> strip_quotes("'foo'")
    "foo"
    >>> strip_quotes('"foo"')
    "foo"
    cSs@|j�}t|�dko?|d|dko?|ddkS(Niii����t"t'(R�R�(tstripRS(ts((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytis_quoted_stringYscSsP|j�}t|�dkoO|ddkoO|d|dkoO|ddkS(	Niituii����R�R�(R�R�(R�RS(R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytis_quoted_unicode_s
ii����i(R�(R�R�R�R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR�Ps			cCs|itjrdndd6S(NR�R�t_(RtPY3(R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt
str_prefixostCaptureQueriesContextcBsSeZdZd�Zd�Zd�Zd�Zed��Zd�Z	d�Z
RS(sU
    Context manager that captures queries executed by the specified connection.
    cCs
||_dS(N(t
connection(R R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR!wscCs
t|j�S(N(titertcaptured_queries(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__iter__zscCs|j|S(N(R�(R tindex((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR/}scCs
t|j�S(N(RSR�(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt__len__�scCs|jj|j|j!S(N(R�tqueriestinitial_queriest
final_queries(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��scCsJ|jj|_t|j_t|jj�|_d|_tj	t
�|S(N(R�tuse_debug_cursorR$RSR�R�RcR�Rt
disconnectR	(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyRp�s	
cCsE|j|j_tjt�|dk	r,dSt|jj�|_dS(N(	R�R�RtconnectR	RcRSR�R�(R RrRsRt((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyRu�s

(R)R*R7R!R�R/R�tpropertyR�RpRu(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR�ss					tIgnoreDeprecationWarningsMixincBs eZeZd�Zd�ZRS(cCsItt|�j�tj�|_|jj�tjdd|j�dS(Ntignoretcategory(R.R�tsetUpRHtcatch_warningsRptfilterwarningst
warning_class(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��s
cCs-|jjtj��tt|�j�dS(N(R�Rutsystexc_infoR.R�ttearDown(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��s(R)R*RKR�R�R�(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��s	t%IgnorePendingDeprecationWarningsMixincBseZeZRS((R)R*tPendingDeprecationWarningR�(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��sc#sdg��fd�}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�j|�dS(N(tappend(tmsg(tcalls(s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytreplacement�sN(tloggingt	getLoggerRVRf(tlogger_namet	log_levelR�tloggertorig((R�s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytpatch_logger�s	tTransRealMixincBs eZdZd�Zd�ZRS(s�This is the only way to reset the translation machinery. Otherwise
    the test suite occasionally fails because of global state pollution
    between tests.cCsDddlm}i|_t�|_d|_i|_i|_dS(Ni����(t
trans_real(	tdjango.utils.translationR�t
_translationsRt_activeRct_defaultt	_acceptedt_checked_languages(R R�((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pytflush_caches�s			cCs!|j�tt|�j�dS(N(R�R.R�R�(R ((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��s
(R)R*R7R�R�(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyR��s	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.(sApproximatesContextLists
get_runnersoverride_settingssrequires_tz_supportssetup_test_environmentsteardown_test_environment(Gt
contextlibRR�R�R�t	threadingRttimeRHt	functoolsRtxml.dom.minidomRRtdjango.confRRtdjango.coreRtdjango.core.signalsRt	django.dbR	tdjango.httpR
tdjango.templateRRR
tdjango.template.loadersRtdjango.test.signalsRRtdjango.utils.encodingRtdjango.utilsRR�Rtdjango.utils.unittestRt__all__RaR`t
TZ_SUPPORTtobjectRtlistRR>RRRJRMRORcRR2RjRlRR�R�R�R�R�R�R�R�R(((s3/tmp/pip-install-XxeQeY/django/django/test/utils.pyt<module>s\									>	A		$

https://t.me/AnonymousX5 - 2025