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/testcases.pyc
�
r�\c@slddlmZddlmZddlZddlZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddl
Z
ddlZddlmZddlmZddlmZddlmZmZdd	lmZdd
lmZddlmZddlmZdd
l m!Z!m"Z"ddl#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5ddl6m7Z7ddl8m9Z9m:Z:m;Z;m<Z<ddl=m>Z>m?Z@ddlAmBZBddlCmDZDmEZEddlFmGZGddlHmIZIddlJmKZKdddd d!fZLd"�ZMe*jNZOe*jPZQe*jRZSe*jTZUe*jVZWd#�ZXd$�ZYd%�ZZd&�Z[d'e9fd(��YZ\d)e]fd*��YZ^d+e^fd,��YZ_d-e@j`fd.��YZad/eafd0��YZbd1�Zcd2ebfd3��YZ`d4�Zdd5�Zed6�Zfd7e!fd8��YZgejhd9d9d:fkr�e
jiZjn=ejhd;d<d:fkr�e
jkZjnd=e
jkfd>��YZjd?e"fd@��YZldAefdB��YZmdCe
jnfdD��YZodEebfdF��YZpdS(Gi����(tunicode_literals(tcopyN(twraps(tsettings(tStaticFilesHandler(tmail(tValidationErrortImproperlyConfigured(tWSGIHandler(tcall_command(tno_style(tflush(tWSGIRequestHandlert
WSGIServer(tclear_url_cachestset_urlconf(t
connectiontconnectionstDEFAULT_DB_ALIASttransaction(tcache(t	CharField(t	QueryDict(tClient(tHTMLParseErrort
parse_html(ttemplate_rendered(tCaptureQueriesContexttContextListtoverride_settingstcompare_xml(tsixtunittest(t
force_text(turlsplitt
urlunsplit(tskipIf(t	safe_repr(tserveuTestCaseuTransactionTestCaseuSimpleTestCaseuskipIfDBFeatureuskipUnlessDBFeaturecCs4|dkrg}nt|t�s0|g}n|S(ue
    Puts value into a list if it's not already one.
    Returns an empty list if value is None.
    N(tNonet
isinstancetlist(tvalue((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytto_list0s
	cOsdS(N((targstkwargs((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytnopAscCs1tt_tt_tt_tt_tt_dS(N(R.Rtcommittrollbacktenter_transaction_managementtleave_transaction_managementtabort(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytdisable_transaction_methodsDs
				cCs1tt_tt_tt_tt_t	t_
dS(N(treal_commitRR/t
real_rollbackR0t!real_enter_transaction_managementR1t!real_leave_transaction_managementR2t
real_abortR3(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytrestore_transaction_methodsKs
				cCsVyt|�}Wn?tk
rQ}d||jf}|j|j||��nX|S(Nu%s
%s(RRtmsgtfailt_formatMessage(tselfthtmltuser_msgR;tdomtetstandardMsg((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassert_and_parse_htmlSst_AssertNumQueriesContextcBseZd�Zd�ZRS(cCs,||_||_tt|�j|�dS(N(t	test_casetnumtsuperREt__init__(R>RFRGR((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRI]s		cCsbtt|�j|||�|dk	r,dSt|�}|jj||jd||jf�dS(Nu %d queries executed, %d expected(RHREt__exit__R'tlenRFtassertEqualRG(R>texc_typet	exc_valuet	tracebacktexecuted((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRJbs	(t__name__t
__module__RIRJ(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRE\s	t_AssertTemplateUsedContextcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs4||_||_g|_g|_t�|_dS(N(RFt
template_nametrendered_templatestrendered_template_namesRtcontext(R>RFRT((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRIos
				cKs=|jj|�|jj|j�|jjt|��dS(N(RUtappendRVtnameRWR(R>tsendertsignalttemplateRWR-((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyton_template_rendervscCs|j|jkS(N(RTRV(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyttest{scCsd|jS(Nu%s was not rendered.(RT(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytmessage~scCstj|j�|S(N(RtconnectR](R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt	__enter__�scCs�tj|j�|dk	r dS|j�s�|j�}t|j�dkrZ|d7}n|ddj|j	�7}|j
j|�ndS(Niu No template was rendered.u& Following templates were rendered: %su, (Rt
disconnectR]R'R^R_RKRUtjoinRVRFR<(R>RMRNROR_((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRJ�s
(RQRRRIR]R^R_RaRJ(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRSns					t_AssertTemplateNotUsedContextcBseZd�Zd�ZRS(cCs|j|jkS(N(RTRV(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR^�scCsd|jS(Nu%s was rendered.(RT(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR_�s(RQRRR^R_(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRd�s	tSimpleTestCasecBs@eZeZdZdd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	d
ddd�Zdd
ded
�Zd
ded�Zdd�Zdd�Zdddd�Zdddd�Zdd�Zdddd�Zdd�Zdd�Zddd�Zdd�Zdd�Zdd�ZRS(u�save_warnings_state/restore_warnings_state django.test.*TestCase methods are deprecated. Use Python's warnings.catch_warnings context manager instead.cCs	t||j�}t|jdt�p6t|dt�}|s�y|j�Wq�ttfk
ri�q�tk
r�|j|t	j
��dSXntt|�j
|�|sy|j�Wqttfk
r��qtk
r|j|t	j
��dSXndS(u�
        Wrapper around default __call__ method to perform common Django test
        set up. This means that user-defined Test Cases aren't required to
        include a call to super().setUp().
        u__unittest_skip__N(tgetattrt_testMethodNamet	__class__tFalset
_pre_setuptKeyboardInterruptt
SystemExitt	ExceptiontaddErrortsystexc_infoRHRet__call__t_post_teardown(R>tresultt
testMethodtskipped((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRq�s(

cCs&|j�|_|j�gt_dS(u�Performs any pre-test setup. This includes:

        * Creating a test client.
        * If the class has a 'urls' attribute, replace ROOT_URLCONF with it.
        * Clearing the mail test outbox.
        N(tclient_classtclientt_urlconf_setupRtoutbox(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRj�s
cCs?td�t|d�r;tj|_|jt_t�ndS(Nuurls(RR'thasattrRtROOT_URLCONFt_old_root_urlconfturlsR(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRx�s

cCs|j�dS(u{Performs any post-test things. This includes:

        * Putting back the original ROOT_URLCONF if it was changed.
        N(t_urlconf_teardown(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRr�scCs3td�t|d�r/|jt_t�ndS(Nu_old_root_urlconf(RR'RzR|RR{R(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR~�s
cCs*tj|jtdd�tj|_dS(u8
        Saves the state of the warnings module
        t
stackleveliN(twarningstwarnt	_warn_txttDeprecationWarningtfilterst_warnings_state(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytsave_warnings_state�scCs*tj|jtdd�|jt_dS(uo
        Restores the state of the warnings module to the state
        saved by save_warnings_state()
        RiN(R�R�R�R�R�R�(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytrestore_warnings_state�scKs
t|�S(u�
        A context manager that temporarily sets a setting and reverts
        back to the original value when exiting the context.
        (R(R>R-((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR�si.i�uc	Cs�|r|d7}nt|d�r�|jt|j�dk|d|j|f�|j|jdd||d|jdd|f�|jd\}}|j|j||d|j|f�n�|j|j||d|j|f�|j}t|�\}}	}
}}|jj	|
t
|��}
|j|
j||d	|
|
j|f�t|�\}}}}}|pz|s�td
|p�d|||f�}n|j|||d||f�d
S(u�Asserts that a response redirected to a specific URL, and that the
        redirect URL can be loaded.

        Note that assertRedirects won't work for external links since it uses
        TestClient to do a request.
        u: uredirect_chainiuHResponse didn't redirect as expected: Response code was %d (expected %d)iuPInitial response didn't redirect as expected: Response code was %d (expected %d)i����uNResponse didn't redirect as expected: Final Response code was %d (expected %d)uKCouldn't retrieve redirection page '%s': response code was %d (expected %d)uhttpu
testserveru*Response redirected to '%s', expected '%s'N(Rzt
assertTrueRKtredirect_chaintstatus_codeRLturlR"RwtgetRR#(R>tresponsetexpected_urlR�ttarget_status_codethostt
msg_prefixR�tschemetnetloctpathtquerytfragmenttredirect_responsete_schemete_netlocte_pathte_queryt
e_fragment((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertRedirects�s<
	c
Cs�t|d�r5t|j�r5|jr5|j�n|rH|d7}n|j|j||d|j|f�|jr�dj|j�}n	|j	}t
|t�s�|r�t|d|j
�}|j|j
�}d|}nt|�}|rt||dd�}t||dd�}n|j|�}	|dk	ra|j|	||d	|	||f�n|j|	d
k|d|�dS(
uq
        Asserts that a response indicates that some content was retrieved
        successfully, (i.e., the HTTP status code was as expected), and that
        ``text`` occurs ``count`` times in the content of the response.
        If ``count`` is None, the count doesn't matter - the assertion is true
        if the text occurs at least once in the response.
        urenderu: u=Couldn't retrieve content: Response code was %d (expected %d)ttencodingu'%s'u%Response's content is not valid HTML:u"Second argument is not valid HTML:u2Found %d instances of %s in response (expected %d)iuCouldn't find %s in responseN(Rztcallabletrendertis_renderedRLR�t	streamingRctstreaming_contenttcontentR(tbytesR!t_charsettdecodetreprRDR'tcountR�(
R>R�ttextR�R�R�R?R�t	text_reprt
real_count((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertContains2s8


		
	c	Cs)t|d�r5t|j�r5|jr5|j�n|rH|d7}n|j|j||d|j|f�|j}t|t�s�|r�t	|d|j
�}|j|j
�}d|}nt|�}|rt
||d
d�}t
||d
d�}n|j|j|�d|d	|�d
S(u�
        Asserts that a response indicates that some content was retrieved
        successfully, (i.e., the HTTP status code was as expected), and that
        ``text`` doesn't occurs in the content of the response.
        urenderu: u=Couldn't retrieve content: Response code was %d (expected %d)R�u'%s'u%Response's content is not valid HTML:u"Second argument is not valid HTML:iuResponse should not contain %sN(RzR�R�R�RLR�R�R(R�R!R�R�R�RDR'R�(R>R�R�R�R�R?R�R�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertNotContainsas*



	
	c
Cs�|r|d7}nt|j�}|s<|j|d�nt|�}t}x2t|�D]$\}}	||	kryq[nt}x�|D]�}
|rA||	|jkr�|	|j|}|j|
|k|d||||
t|�f�q{||	|j	kr |j|d|||f�q{|j|d|||f�q�|	|j
�}|j|
|k|d|||
|f�q�Wq[W|s�|j|d|�ndS(	ue
        Asserts that a form used to render the response has a specific field
        error.
        u: u8Response did not use any contexts to render the responseu]The field '%s' on form '%s' in context %d does not contain the error '%s' (actual errors: %s)u<The field '%s' on form '%s' in context %d contains no errorsu;The form '%s' in context %d does not contain the field '%s'uYThe form '%s' in context %d does not contain the non-field error '%s' (actual errors: %s)u1The form '%s' was not used to render the responseN(R+RWR<Rit	enumeratetTrueterrorsR�R�tfieldstnon_field_errors(
R>R�tformtfieldR�R�tcontextst
found_formtiRWterrtfield_errorsR�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertFormError�s<

!c
Cs|r|d7}nt|j�}|s<|j|d�nt|�}t}xt|�D]�\}	}
||
kryq[nt}x�|D]�}|dk	re||
|j|jkr|
|j|j|}|j	||k|d||||	|t
|�f�qU||
|j|jkrA|j|d||||	f�qU|j|d|||	|f�q�|dk	r�|
|j|j�}
|j
t|
�dk|d|||	f�|j	||
k|d|||	|t
|
�f�q�|
|j�}|j
t|�dk|d	||	f�|j	||k|d
||	|t
|�f�q�Wq[W|s{|j|d|�ndS(
u^
        Asserts that a formset used to render the response has a specific error.

        For field errors, specify the ``form_index`` and the ``field``.
        For non-field errors, specify the ``form_index`` and the ``field`` as
        None.
        For non-form errors, specify ``form_index`` as None and the ``field``
        as None.
        u: u8Response did not use any contexts to render the responseuiThe field '%s' on formset '%s', form %d in context %d does not contain the error '%s' (actual errors: %s)uHThe field '%s' on formset '%s', form %d in context %d contains no errorsuGThe formset '%s', form %d in context %d does not contain the field '%s'iuNThe formset '%s', form %d in context %d does not contain any non-field errors.ueThe formset '%s', form %d in context %d does not contain the non-field error '%s' (actual errors: %s)uDThe formset '%s' in context %d does not contain any non-form errors.u[The formset '%s' in context %d does not contain the non-form error '%s' (actual errors: %s)u4The formset '%s' was not used to render the responseN(R+RWR<RiR�R�R'tformsR�R�R�R�R�tassertFalseRKtnon_form_errors(R>R�tformsett
form_indexR�R�R�R�t
found_formsetR�RWR�R�R�R�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertFormsetError�sV

#c
Cs�|dkr'|dkr'td��n|r:|d7}nt|d�s\|dkr�|r�|rq|}d}nt||�}|Sg|jD]}|j^q�}|s�|j|d�n|j||k|d|dj|�f�dS(u�
        Asserts that the template with the provided name was used in rendering
        the response. Also usable as context manager.
        u7response and/or template_name argument must be providedu: u	templatesu(No templates used to render the responseuYTemplate '%s' was not a template used to render the response. Actual template(s) used: %su, N(	R't	TypeErrorRzRSt	templatesRYR<R�Rc(R>R�RTR�RWttttemplate_names((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertTemplateUseds 
"	cCs�|dkr'|dkr'td��n|r:|d7}nt|d�s\|dkr�|r�|rq|}d}nt||�}|Sg|jD]}|j^q�}|j||k|d|�dS(u�
        Asserts that the template with the provided name was NOT used in
        rendering the response. Also usable as context manager.
        u7response and/or template_name argument must be providedu: u	templatesu=Template '%s' was used unexpectedly in rendering the responseN(R'R�RzRdR�RYR�(R>R�RTR�RWR�R�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertTemplateNotUsed s
"	cOs%tj||tj|�|||�S(ul
        Asserts that the message in a raised exception matches the passed
        value.

        Args:
            expected_exception: Exception class expected to be raised.
            expected_message: expected error message string value.
            callable_obj: Function to be called.
            args: Extra args.
            kwargs: Extra kwargs.
        (RtassertRaisesRegextretescape(R>texpected_exceptiontexpected_messagetcallable_objR,R-((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertRaisesMessage8s
cCs|dkrg}n|dkr*i}n|||�}||t|dt��}xL|j�D]>\}	}
|j|j|	�|
�|j|j|	�|
�qaWx�|j�D]�\}	}|jt��}|j|	�WdQX|j|jj	|�|jt��}|j|	�WdQX|j|jj	|�q�Wt
|jd�g}
xe|jD]Z}|jt��}|j|�WdQX|j|jj	|
�|j|j|�|�qVWt
|t�r|jidd6dd6�|jt|||�|��ndS(uQ
        Asserts that a form field behaves correctly with various inputs.

        Args:
            fieldclass: the class of the field to be tested.
            valid: a dictionary mapping valid inputs to their expected
                    cleaned values.
            invalid: a dictionary mapping invalid inputs to one or more
                    raised error messages.
            field_args: the args passed to instantiate the field
            field_kwargs: the kwargs passed to instantiate the field
            empty_value: the expected clean output for inputs in empty_values

        trequiredNurequirediu
min_lengthiu
max_length(R'tdictRititemsRLtcleantassertRaisesRt	exceptiontmessagesR!terror_messagestempty_valuest
issubclassRtupdateR�R((R>t
fieldclasstvalidtinvalidt
field_argstfield_kwargstempty_valueR�toptionaltinputtoutputR�tcontext_managerterror_requiredRB((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertFieldOutputHs8		cCs�t|||d�}t|||d�}||kr�dt|t�t|t�f}ddjtjtj|�j�tj|�j���}|j	||�}|j
|j||��ndS(u�
        Asserts that two HTML snippets are semantically the same.
        Whitespace in most cases is ignored, and attribute ordering is not
        significant. The passed-in arguments must be valid HTML.
        u!First argument is not valid HTML:u"Second argument is not valid HTML:u%s != %su
N(RDR%R�RctdifflibtndiffRt	text_typet
splitlinest_truncateMessageR<R=(R>thtml1thtml2R;tdom1tdom2RCtdiff((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertHTMLEqualzs		cCsxt|||d�}t|||d�}||krtdt|t�t|t�f}|j|j||��ndS(u?Asserts that two HTML snippets are not semantically equivalent.u!First argument is not valid HTML:u"Second argument is not valid HTML:u%s == %sN(RDR%R�R<R=(R>R�R�R;R�R�RC((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertHTMLNotEqual�s		cCs�t||dd�}t||dd�}|j|�}|dk	rl|j|||d|||f�n|j|dk|d|�dS(Nu!First argument is not valid HTML:u"Second argument is not valid HTML:u4Found %d instances of '%s' in response (expected %d)iuCouldn't find '%s' in response(RDR'R�RLR�(R>tneedlethaystackR�R�R�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertInHTML�s		cCs�ytj|�}Wn"tk
r7|jd|�nXt|tj�r�ytj|�}Wq�tk
r�|jd|�q�Xn|j||d|�dS(Nu$First argument is not valid JSON: %ru%Second argument is not valid JSON: %rR;(tjsontloadst
ValueErrorR<R(Rtstring_typesRL(R>trawt
expected_dataR;tdata((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertJSONEqual�s

cCs�yt||�}Wn6tk
rK}d|}|j|j||��nEX|s�dt|t�t|t�f}|j|j||��ndS(u�
        Asserts that two XML snippets are semantically the same.
        Whitespace in most cases is ignored, and attribute ordering is not
        significant. The passed-in arguments must be valid XML.
        u,First or second argument is not valid XML
%su%s != %sN(RRmR<R=R%R�(R>txml1txml2R;RsRBRC((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertXMLEqual�s
"cCs�yt||�}Wn6tk
rK}d|}|j|j||��nEX|r�dt|t�t|t�f}|j|j||��ndS(u�
        Asserts that two XML snippets are not semantically equivalent.
        Whitespace in most cases is ignored, and attribute ordering is not
        significant. The passed-in arguments must be valid XML.
        u,First or second argument is not valid XML
%su%s == %sN(RRmR<R=R%R�(R>R�RR;RsRBRC((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertXMLNotEqual�s
"N(RQRRRRvR�R'RqRjRxRrR~R�R�RR�RiR�R�R�R�R�R�R�R�R�R�R�R�RR(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRe�s:							:.#4L1tTransactionTestCasecBsheZeZdZd�Zed�Zd�Z	d�Z
d�Zd�Ze
ed�Zdd�ZRS(	cCs�tt|�j�|jdk	rqtj|j�x<|jdt�D]%}t	j
jdddtd|�qEWny|j�Wn0t
k
r�|jdk	r�tj�n�nXdS(uaPerforms any pre-test setup. This includes:

        * If the class has an 'available_apps' attribute, restricting the app
          cache to these applications, then firing post_syncdb -- it must run
          with the correct set of applications for the test case.
        * If the class has a 'fixtures' attribute, installing these fixtures.
        tinclude_mirrorst	verbosityitinteractivetdatabaseN(RHRRjtavailable_appsR'Rtset_available_appst_databases_namesRiRtCommandtemit_post_syncdbt_fixture_setupRmtunset_available_apps(R>tdb_name((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRj�s

cCsLt|dt�rAgtD]$}|s7t|jdr|^qStgSdS(Numulti_dbuTEST_MIRROR(RfRiRt
settings_dictR(R>Rtalias((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR
�s
"cCs�t|}|jjr�|jjt�|jj��}|r�tj	d|��/|j
�}x|D]}|j|�qcWWdQXq�ndS(Ntusing(Rtfeaturestsupports_sequence_resettopstsequence_reset_by_name_sqlR
t
introspectiont
sequence_listRt commit_on_success_unless_managedtcursortexecute(R>Rtconntsql_listRtsql((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt_reset_sequences�s

cCstxm|jdt�D]Y}|jr2|j|�nt|d�rtd|jidd6|d6td6�qqWdS(NRufixturesuloaddataiu	verbosityudatabaseuskip_validation(R
Ritreset_sequencesRRzR	tfixturesR�(R>R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR
s	cCsTzB|j�tt|�j�xtj�D]}|j�q-WWdtj�XdS(u!Performs any post-test things. This includes:

        * Flushing the contents of the database, to leave a clean slate. If
          the class has an 'available_apps' attribute, post_syncdb isn't fired.
        * Force-closing the connection, so the next test gets a clean cursor.
        N(	t_fixture_teardownRHRRrRtalltcloseRR(R>R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRrs
cCsgx`|jdt�D]L}tddddtd|dtdtd	|jdk	d
|jdk	�qWdS(NRuflushRiRRtskip_validationR t
allow_cascadetinhibit_post_syncdb(R
RiR	R�RR'(R>R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR")scCs�tjj||�}|s7|jt|�t|��St|�}t|�dkr}t|d�r}|jr}t	d��n|jt|�|�S(NiuordereduKTrying to compare non-ordered queryset against more than one ordered values(
RtmovestmapRLtsetR)RKRztorderedR�(R>tqstvaluest	transformR+R�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertQuerysetEqual3s+cOs\|jdt�}t|}t|||�}|dkr>|S|�|||�WdQXdS(Nuusing(tpopRRRER'(R>RGtfuncR,R-RRRW((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytassertNumQueries?s
N(RQRRRiR R'RRjR�R
RR
RrR"R�R/R2(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR�s						
cCstd�tj�D��S(u?
    Returns True if all connections support transactions.
    css|]}|jjVqdS(N(Rtsupports_transactions(t.0R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pys	<genexpr>Os(R#R(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt connections_support_transactionsKs	tTestCasecBs eZdZd�Zd�ZRS(uO
    Does basically the same as TransactionTestCase, but surrounds every test
    with a transaction, monkey-patches the real transaction management routines
    to do nothing, and rollsback the test transaction at the end of the test.
    You have to use TransactionTestCase, if you need transaction management
    inside a test.
    cCs
t�stt|�j�S|js2td��i|_x>|j�D]0}tj	d|�|j|<|j|j
�qHWt�x�|jdt�D]l}t
|d�r�y3td|jidd6td6|d	6td
6�Wqtk
r�|j��qXq�q�WdS(Nu4reset_sequences cannot be used on TestCase instancesRRufixturesuloaddataiu	verbosityucommitudatabaseuskip_validation(R5RHR6R
R tAssertionErrortatomicsR
RtatomicRaR4RiRzR	R!R�RmR"(R>R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR
\s(		

cCskt�stt|�j�St�xAt|j��D]-}tt|_	|j
|jddd�q6WdS(N(
R5RHR6R"R:treversedR
R�Rtneeds_rollbackR8RJR'(R>R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR"ws	
(RQRRt__doc__R
R"(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR6Ss	cs��fd�}|S(Ncs[t�t�ot�t�sHt�����fd��}|}n�}�|_|S(Ncs(��rtj���n�||�S(N(tut2tSkipTest(R,R-(t	conditiontreasont	test_func(s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytskip_wrapper�s	(R(ttypeR�R6Rt__unittest_skip_why__(RARBt	test_item(R?R@(RAs7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt	decorator�s!		((R?R@RF((R?R@s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt
_deferredSkip�s
cst�fd�d��S(u9
    Skip a test if a database has the named feature
    csttj��S(N(RfRR((tfeature(s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt<lambda>�suDatabase has feature %s(RG(RH((RHs7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytskipIfDBFeature�scst�fd�d��S(u=
    Skip a test unless a database has the named feature
    csttj��S(N(RfRR((RH(s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRI�su#Database doesn't support feature %s(RG(RH((RHs7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytskipUnlessDBFeature�stQuietWSGIRequestHandlercBseZdZd�ZRS(u�
    Just a regular WSGIRequestHandler except it doesn't log to the standard
    output any of the requests received, so as to not clutter the output for
    the tests' results.
    cGsdS(N((R,((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytlog_message�s(RQRRR<RM(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRL�siiiit_ImprovedEventcBseZdZdd�ZRS(u�
        Does the same as `threading.Event` except it overrides the wait() method
        with some code borrowed from Python 2.7 to return the set state of the
        event (see: http://hg.python.org/cpython/rev/b5aa8aa78c0f/). This allows
        to know whether the wait() method exited normally or because of the
        timeout. This class can be removed when Django supports only Python >= 2.7.
        cCsI|jj�z'|js,|jj|�n|jSWd|jj�XdS(N(t_Event__condtacquiret_Event__flagtwaittrelease(R>ttimeout((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRR�s
	N(RQRRR<R'RR(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRN�stStoppableWSGIServercBs>eZdZd�Zdd�Zd�Zd�Zd�ZRS(uW
    The code in this class is borrowed from the `SocketServer.BaseServer` class
    in Python 2.6. The important functionality here is that the server is non-
    blocking and that it can be shut down at any moment. This is made possible
    by the server regularly polling the socket and checking if it has been
    asked to stop.
    Note for the future: Once Django stops supporting Python 2.6, this class
    can be removed as `WSGIServer` will have this ability to shutdown on
    demand and will not require the use of the _ImprovedEvent class whose code
    is borrowed from Python 2.7.
    cOs2tt|�j||�t�|_t|_dS(N(RHRURIRNt"_StoppableWSGIServer__is_shut_downRit_StoppableWSGIServer__serving(R>R,R-((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRI�sg�?cCsnt|_|jj�xD|jr\tj|ggg|�\}}}|r|j�qqW|jj�dS(uw
        Handle one request at a time until shutdown.

        Polls for shutdown every poll_interval seconds.
        N(R�RWRVtcleartselectt_handle_request_noblockR*(R>t
poll_intervaltrtwRB((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt
serve_forever�s	
$cCs.t|_|jjd�s*td��ndS(u�
        Stops the serve_forever loop.

        Blocks until the loop has finished. This must be called while
        serve_forever() is running in another thread, or it will
        deadlock.
        iunFailed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response.N(RiRWRVRRtRuntimeError(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytshutdown�s	cCs7tj|gggd�}|ds)dS|j�dS(u/Handle one request, possibly blocking.
        iN(RYR'RZ(R>tfd_sets((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pythandle_request�s
cCs�y|j�\}}Wntjk
r-dSX|j||�r�y|j||�Wq�tk
r�|j||�|j|�q�XndS(u�
        Handle one request, without blocking.

        I assume that select.select has returned that the socket is
        readable before this function was called, so there should be
        no risk of blocking in get_request().
        N(tget_requesttsocketterrortverify_requesttprocess_requestRmthandle_errort
close_request(R>trequesttclient_address((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRZ�s
(RQRRR<RIR^R`RbRZ(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRU�s			t_MediaFilesHandlercBs)eZdZd�Zd�Zd�ZRS(u�
    Handler for serving the media files. This is a private class that is
    meant to be used solely as a convenience by LiveServerThread.
    cCstjS(N(Rt
MEDIA_ROOT(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytget_base_dirscCstjS(N(Rt	MEDIA_URL(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytget_base_urlscCs3|jt|jd�}t||d|j��S(Nit
document_root(R�RKtbase_urlR&Rn(R>Rjtrelative_url((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR&s(RQRRR<RnRpR&(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRls		tLiveServerThreadcBs/eZdZdd�Zd�Zdd�ZRS(uL
    Thread for running a live http server while the tests are running.
    cCsS||_d|_||_tj�|_d|_||_t	t
|�j�dS(N(R�R'tporttpossible_portst	threadingtEventtis_readyRetconnections_overrideRHRtRI(R>R�RvRz((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRI's					cCs?|jr6x*|jj�D]\}}|t|<qWny�ttt���}x�t|j�D]�\}}yt|j	|ft
�|_WnJtj
k
r�}|dt|j�kr�|jtjkr�q^q��q^X||_Pq^W|jj|�|jj�|jj�Wn)tk
r:}||_
|jj�nXdS(ul
        Sets up the live server and databases, and then loops over handling
        http requests.
        iN(RzR�RRRlRR�RvRUR�RLthttpdRdReRKterrnot
EADDRINUSERutset_appRyR*R^Rm(R>RRthandlertindexRuRB((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytrun0s,		
	cCsFt|d�r,|jj�|jj�ntt|�j|�dS(Nuhttpd(RzR{R`tserver_closeRHRtRc(R>RT((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRc[s
N(RQRRR<R'RIR�Rc(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyRt"s		+tLiveServerTestCasecBsJeZdZed��Zed��Zed��Zed��ZRS(u	
    Does basically the same as TransactionTestCase but also launches a live
    http server in a separate thread so that the tests may use another testing
    framework, such as Selenium for example, instead of the built-in dummy
    client.
    Note that it inherits from TransactionTestCase instead of TestCase because
    the threads do not share the same transactions (unless if using in-memory
    sqlite) and each thread needs to commit all their transactions so that the
    other thread can see the changes.
    cCsd|jj|jjfS(Nuhttp://%s:%s(t
server_threadR�Ru(R>((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pytlive_server_urloscCsi}xctj�D]U}|jdjdd�ddkr|jddkrt|_|||j<qqWtjj	d	d
�}g}y�|j
d�\}}x�|j
d�D]�}ttt
|j
d
���}t|�dks�t�t|�dkr|j|d�q�x0t|d|dd�D]}	|j|	�q-Wq�WWn>tk
r�d|}
tjtt|
�tj�d�nXt|||�|_t|j_|jj�|jjj�|jjr�|j�|jj�nt t!|�j"�dS(NuENGINEu.ii����usqlite3u
spatialiteuNAMEu:memory:uDJANGO_LIVE_TEST_SERVER_ADDRESSulocalhost:8081u:u,u-iiu'Invalid address ("%s") for live server.(usqlite3u
spatialite(ii(#RR#RtrsplitR�tallow_thread_sharingRtostenvironR�tsplitR)R)tintRKR7RXtrangeRmRtreraiseRRoRpRtR�tdaemontstartRyRRRet_tearDownClassInternalRHR�t
setUpClass(tclsRzRtspecified_addressRvR�tport_rangest
port_rangetextremesRuR;((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR�ts<#		"

'

cCs|t|d�r|jj�nxVtj�D]H}|jdjdd�dd
kr,|jdd	kr,t|_q,q,WdS(Nu
server_threaduENGINEu.ii����usqlite3u
spatialiteuNAMEu:memory:(usqlite3u
spatialite(	RzR�RcRR#RR�RiR�(R�R((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR��s#cCs!|j�tt|�j�dS(N(R�RHR�t
tearDownClass(R�((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR��s
(	RQRRR<tpropertyR�tclassmethodR�R�R�(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyR�cs

3(qt
__future__RRR�R|t	functoolsRR�R�R�RdRoRYRwR�tdjango.confRt#django.contrib.staticfiles.handlersRtdjango.coreRtdjango.core.exceptionsRRtdjango.core.handlers.wsgiRtdjango.core.managementR	tdjango.core.management.colorR
tdjango.core.management.commandsRtdjango.core.servers.basehttpRR
tdjango.core.urlresolversRRt	django.dbRRRRtdjango.db.models.loadingRtdjango.forms.fieldsRtdjango.httpRtdjango.test.clientRtdjango.test.htmlRRtdjango.test.signalsRtdjango.test.utilsRRRRtdjango.utilsRR R=tdjango.utils.encodingR!t#django.utils.six.moves.urllib.parseR"R#tdjango.utils.unittestR$tdjango.utils.unittest.utilR%tdjango.views.staticR&t__all__R+R/R5R0R6R1R7R2R8R3R9R.R4R:RDREtobjectRSRdR6ReRR5RGRJRKRLtversion_infoRxRNt_EventRURltThreadRtR�(((s7/tmp/pip-install-XxeQeY/django/django/test/testcases.pyt<module>s�""											&��;v	0			JA

https://t.me/AnonymousX5 - 2025