
    ~/jXb                       S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SS	KrSS	KrSS	KrSS	KrSS
KJr  SSKJr  SSKJr  SSKJr  SS	KrSSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSK!J"r"  SSK!J#r#  SSK$J%r%  SSK$J&r&  SSK$J'r'  SSK$J(r(  SSK)J*r*  SSK)J+r+  SSK)J,r,  SSK-J.r.  SSK-J/r/  SSK0J1r1  SS K0J2r2  \Rf                  S	S! S":  a  SS#K4J5r5  \(       a  SS$KJ6r6  SS	KrSS	K7r8\9\:\;   \;\Rl                  4   \9S%   -  r<        S7S& jr= " S' S(\*5      r> " S) S*\+5      r?\" S+S,9S8S- j5       r@S9S. jrAS:S/ jrB " S0 S1\
5      rCS;S2 jrDS3rE\" S+S49S<S5 j5       rF    S=S6 jrGg	)>z4Discover and run std-library "unittest" style tests.    )annotations)Callable)	Generator)Iterable)Iterator)auto)EnumN)Any)TYPE_CHECKING)TestCase)fixtures)ExceptionInfo)assert_never)is_async_function)hookimpl)FixtureRequest)MonkeyPatch)	Collector)Item)exit)fail)skip)xfail)Class)Function)Module)CallInfo)check_interactive_exception)SubtestContext)SubtestReport         )ExceptionGroup)TracebackType)NNNc                     [         R                  S   n[        X#R                  5      (       d  g  [
        R                  " U5      (       a  g [        R                  XUS9$ ! [         a     g f = f)Nunittest)nameobj)	sysmodules
issubclassr   	Exceptioninspect
isabstractUnitTestCasefrom_parent)	collectorr)   r*   uts       O/root/lseg-credit/backend/venv/lib/python3.13/site-packages/_pytest/unittest.pypytest_pycollect_makeitemr6   ;   sn    [[$ #{{++ , ###Ic#BB  s   -A! !
A.-A.c                  F    \ rS rSrSrS rS
S jrSS jrSS jrSS jr	Sr
g	)r1   O   Tc                $    U R                  S5      $ )NrunTestr*   selfs    r5   newinstanceUnitTestCase.newinstanceT   s     xx	""    c              #  *  #    SSK Jn  U R                  n[        USS5      (       d  g [	        U5      nU(       d3  U R                  U5        U R                  U5        U R                  5         OU R                  U5        U R                  R                  R                  U R                  5       U S9  U" 5       nSnUR                  U R                  5       HD  n[        U R                  U5      n[        USS5      (       d  M-  [        R                  XS9v   SnMF     U(       do  [        U R                  SS 5      nUbT  [         R"                  R%                  S	S 5      n	U	b  XR&                  R(                  :w  a  [        R                  U SS9v   g g g g 7f)
Nr   )
TestLoader__test__T)holdernodeF)r)   r:   twisted.trial.unittest)r(   rB   r*   getattr_is_skipped'_register_unittest_setup_method_fixture&_register_unittest_setup_class_fixture_register_setup_class_fixture_register_unittest_skip_fixturesession_fixturemanagerparsefactoriesr>   getTestCaseNamesTestCaseFunctionr2   r+   r,   getr   r:   )
r=   rB   clsskippedloaderfoundsomethingr)   xruntestr4   s
             r5   collectUnitTestCase.collect\   s_    'hhsJ--c"88=77<..0005$$33##%D 	4 	
 ++DHH5D$'A1j$//"..t.??!N 6 dhh	48G"[[__%=tD:KK,?,?!?*66t)6LL "@ # s   FFc                   ^^^^^ [        TSS5      m[        TSS5      mTc  Tc  g[        TSS 5      mSU4S jjm    SUUUU4S jjn[        R                  " STR                   3UU S	S
S9  g)zKRegister an auto-use fixture to invoke setUpClass and
tearDownClass (#517).
setUpClassNtearDownClassdoClassCleanupsc                     g N ra   r@   r5   <lambda>EUnitTestCase._register_unittest_setup_class_fixture.<locals>.<lambda>   s    $r@   c                    > [        TSS 5      n U (       d  g U  VVs/ s H  u  poPM	     nnn[        U5      S:X  a  US   e[        SU5      es  snnf )NtearDown_exceptions   r   zUnittest class cleanup errors)rG   lenr%   )	exc_infos_exc
exceptionsrS   s       r5   process_teardown_exceptionsXUnitTestCase._register_unittest_setup_class_fixture.<locals>.process_teardown_exceptions   s]      %:DAI1:;+11#J; :!# m#$%DjQQ <s   Ac              3  8  >#    U R                   n[        U5      (       a!  UR                  n[        R                  " USS9eTb   T" 5         S v    Tb  T" 5         T" 5         T" 5         g ! [         a    T" 5         T" 5         e f = f! T" 5         T" 5         f = f7fNT_use_item_location)rS   rH   __unittest_skip_why__r   r.   )requestrS   reasoncleanuprl   setupteardowns      r5   unittest_setup_class_fixtureYUnitTestCase._register_unittest_setup_class_fixture.<locals>.unittest_setup_class_fixture   s      ++C322nnVEE G .'J	+- ! I/1 	+-s6   ABA* B
B B*BBBB_unittest_setUpClass_fixture_classTr)   funcrE   scopeautousereturnNoners   r   r   zGenerator[None]rG   r   register_fixture__qualname__)r=   rS   rx   ru   rl   rv   rw   s    ` @@@@r5   rJ   3UnitTestCase._register_unittest_setup_class_fixture   s     \4036=X-#0,?	R	.#	.	. 	.0 	!!01A1A0BC-	
r@   c                `   ^ SU4S jjn[         R                  " STR                   3UU SSS9  g)zrRegister an auto-use fixture to skip tests for a class decorated
with @unittest.skip or @unittest.skipIf (#13885).c                H   > [        TSS5      n[        R                  " USS9e)Nrr    Trp   )rG   r   r.   )rs   rt   rS   s     r5   unittest_skip_fixtureKUnitTestCase._register_unittest_skip_fixture.<locals>.unittest_skip_fixture   s#    S"92>F..DAAr@   _unittest_skip_fixture_r{   Tr|   N)rs   r   r   r   )r   r   r   )r=   rS   r   s    ` r5   rL   ,UnitTestCase._register_unittest_skip_fixture   s6    	B 	!!*3+;+;*<=&	
r@   c                   ^^ [        USS5      m[        USS5      mTc  Tc  g    S	UU4S jjn[        R                  " SUR                   3UU SSS9  g)
zORegister an auto-use fixture to invoke setup_method and
teardown_method (#517).setup_methodNteardown_methodc              3     >#    U R                   n[        U5      (       a!  UR                  n[        R                  " USS9eTb  T" XR
                  5        S v   Tb  T" XR
                  5        g g 7fro   )instancerH   rr   r   r.   function)rs   r=   rt   rv   rw   s      r5   unittest_setup_method_fixture[UnitTestCase._register_unittest_setup_method_fixture.<locals>.unittest_setup_method_fixture   sj      ##D4  33nnVEE d,,-#//0 $s   A.A1_unittest_setup_method_fixture_r   Tr|   r   r   )r=   rS   r   rv   rw   s      @@r5   rI   4UnitTestCase._register_unittest_setup_method_fixture   sv     ^T23 148=X-	1#	1	1 	1 	!!233C3C2DE.	
r@   ra   N)r   zIterable[Item | Collector])rS   typer   r   )__name__
__module__r   __firstlineno__
nofuncargsr>   rY   rJ   rL   rI   __static_attributes__ra   r@   r5   r1   r1   O   s%     J#!MF6
p
 
r@   r1   c                  f  ^  \ rS rSr% SrSrSrS\S'   S r\	S 5       r
SU 4S	 jjrSU 4S
 jjrSS jrSS jr      SS jr      SS jrSS.       SS jjr S        S!S jjr S"     S#S jjrSS jrSS jrS$S jrSS jr    S%U 4S jjr        S&S jrS'S jrSrU =r$ )(rQ      TFNz7list[_pytest._code.ExceptionInfo[BaseException]] | None_excinfoc                    [        U R                  [        5      (       d   eU R                  R                  U R                  5      $ r`   )
isinstanceparentr1   r*   r)   r<   s    r5   _getinstanceTestCaseFunction._getinstance   s0    $++|4444{{tyy))r@   c                    U R                   $ r`   )r   r<   s    r5   	_testcaseTestCaseFunction._testcase   s    }}r@   c                h   > S U l         [        TU ]	  5         [        R                  S:  a  S U l        g g )Nr"   )_explicit_tearDownsuperrv   r+   version_info_cached_errors_and_skipsr=   	__class__s    r5   rv   TestCaseFunction.setup   s3    =Ag% QUD) &r@   c                |   > U R                   b  U R                  5         S U l         S U l        U ?[        TU ]  5         g r`   )r   _obj	_instancer   rw   r   s    r5   rw   TestCaseFunction.teardown   s:    "".##%&*D#	Nr@   c                    g r`   ra   r=   testcases     r5   	startTestTestCaseFunction.startTest      r@   c                   [        U5      n [        R                  R                  [           R                  U5      nUR                  nUR                  nU R                   R#                  S/ 5      R%                  W5        g ! [         a      [        R                  " U6 nUR                  SS5        [        SR                  U5      SS9   Nx! [        R                  [        4 a    e [         a    [        SU< 3SS9    Nf = f! [         a    e [        R                   a,    [        R                  R                  R                  5       n  Nf = ff = f)Nr   zCNOTE: Incompatible Exception Representation, displaying natively:

r   Fpytracez6ERROR: Unknown Incompatible Exception representation:
r   )_handle_twisted_exc_info_pytest_coder   BaseExceptionfrom_exc_infovalue	traceback	TypeErrorformat_exceptioninsertr   joinr.   KeyboardInterruptfrom_current__dict__
setdefaultappend)r=   
rawexcinfoexcinfori   valuess        r5   _addexcinfoTestCaseFunction._addexcinfo	  s8   -j9
	Emm11-@NNG
 A!!A. 	  R077@-  	EE&77DFMM3
 %8(9: $ ,,6>; % % >> E!--55BBDE)	EsC   AB 
E>C2D?DDDAEEEEc                     [        US   [        R                  5      (       a  [        US   R                  5        U R                  U5        g ! [         a     Nf = f)Nrf   )r   r   r.   msgr   r   r=   r   r   s      r5   addErrorTestCaseFunction.addError+  sR    	*Q-88Z]&&' 	$  		s   :A 
AAc                &    U R                  U5        g r`   )r   r   s      r5   
addFailureTestCaseFunction.addFailure5  s     	$r@   handle_subtestsc                 ^ ^ SSK Jn  SUU 4S jjnU(       d  U" 5         g [        X5      (       aA  U" 5         T R                  b,  T R                  S   nT R	                  UR
                  X5        g g [        R                  S:  aA  T R                  R                  b*  T R                  5       u  px[        U5      S:X  a  U" 5         g g U" 5         g )Nr   _SubTestc                    >  [         R                  " T SS9e! [         R                   a'    TR                  [        R                  " 5       5         g f = fro   )r   r.   r   r+   exc_info)rt   r=   s   r5   add_skip*TestCaseFunction.addSkip.<locals>.add_skip?  s@    1nnVEE>> 1  01s    8AAr"   r   )unittest.caser   r   r   
addSubTest	test_caser+   r   r   _outcome_obtain_errors_and_skipsrg   )	r=   r   rt   r   r   r   r   subtest_errorsri   s	   ` `      r5   addSkipTestCaseFunction.addSkip:  s     	+	1 	1 Jh))J}}(==, 2 2HG ) ')dmm.D.D.P$($A$A$C!~&!+J , 
r@   c                     [        [        U5      5        g ! [         R                   a'    U R                  [        R
                  " 5       5         g f = fr`   )r   strr.   r   r+   r   )r=   r   r   rt   s       r5   addExpectedFailure#TestCaseFunction.addExpectedFailure[  s:    	-#f+ 	-S\\^,	-s    8AAc                    SnU(       a  USUR                    3-  n [        USS9  g ! [        R                   a'    U R                  [        R
                  " 5       5         g f = f)NzUnexpected successz: Fr   )rt   r   r.   r   r+   r   )r=   r   rt   r   s       r5   addUnexpectedSuccess%TestCaseFunction.addUnexpectedSuccessf  sW    
 #R''C	-e$~~ 	-S\\^,	-s   
( 8A#"A#c                    g r`   ra   r   s     r5   
addSuccessTestCaseFunction.addSuccesst  r   r@   c                    g r`   ra   r   s     r5   stopTestTestCaseFunction.stopTestw  r   r@   c                    g r`   ra   )r=   r   elapseds      r5   addDurationTestCaseFunction.addDurationz  r   r@   c                t   SSK Jn  U R                  nUc   eU" U 5        [        U R                  5      (       a  U" U S9  g [        U R                  [        5      (       d   e[        U R                  5      =(       d    [        U R                  R                  5      nU R                  R                  S5      (       a&  U(       d  UR                  U l        [        USS 5        [        X R                  U R                  5         U" U S9  [        X R                  5        g ! [        X R                  5        f = f)Nr   )&maybe_wrap_pytest_function_for_tracing)resultusepdbtearDownc                     g r`   ra   )argss    r5   rb   *TestCaseFunction.runtest.<locals>.<lambda>  s    Dr@   )_pytest.debuggingr   r   r   r*   r   r   r1   rH   config	getoptionr  r   setattrr)   delattr)r=   r   r   rT   s       r5   rX   TestCaseFunction.runtest}  s    L==###.t4 TXX&&D! dkk<8888!$((+K{4;;??/KG{{$$X..w*2*;*;'*.@A Hii2-%)),)),s   D   D7c                ^   > [         TU ]  U5      nUR                  " S 5      nU(       d  UnU$ )Nc                V    U R                   R                  R                  S5      (       + $ )N
__unittest)frame	f_globalsrR   )rW   s    r5   rb   4TestCaseFunction._traceback_filter.<locals>.<lambda>  s    !''++//==r@   )r   _traceback_filterfilter)r=   r   r   
ntracebackr   s       r5   r  "TestCaseFunction._traceback_filter  s7     G-g6	%%=

 "Jr@   c           
         SSK Jn  U=[        S` =b  u     [        USS9nO(  ==[        S` =b  u   O  =c  O  O    UnOn[	        U5        [
        S    " S WSSSSSS9nUR                  UL a  S O[        UR                  5      nU R                  R                  XS9n	[        R                  " U	[        U[        UR                  5      S	9S S S
9n
U R                  R                  U
S9  [!        Xz5      (       a  U R                  R#                  XU
S9  [$        R&                  S:  a[  U R)                  5       u  p[+        U5      S:  a9  [+        U5      S:  a)  US   nX=S   L a  U H  u  pU R-                  XSS9  M     g g g g g )Nr   )_subtest_msg_sentinelra   T)	_ispytestcall)startstopdurationwhenr  )itemr  )r   kwargs)captured_outputcaptured_logs)report)rE   r  r#  r"   r   Fr   )r   r  tupler   r   r   _messager   ihookpytest_runtest_makereportr    _newr   dictparamspytest_runtest_logreportr   pytest_exception_interactr+   r   r   rg   r   )r=   r   testr   r  exception_infounreachable	call_infor   r#  
sub_reportr   non_subtest_skiplast_subset_errorr   rt   s                   r5   r   TestCaseFunction.addSubTest  s    	8 !.x4!H '4'!)[)TN
	 mm'<<d#dmmBT5545P"''s4+<= 	

 	

++:+>&y==JJ00* 1 
 g%/3/L/L/N,N #$q(S-@1-D$22$6!44,<(XuM -= 5 .E( &r@   c                   SSK Jn  [        R                  S:  d   S5       eU R                  b  U R                  $ U R
                  R                  R                   VVs/ s H  u  p#[        X!5      (       d  M  Uc  M  X#4PM!     nnnU R
                  R                  R                   VVs/ s H  u  p#[        X!5      (       a  M  X#4PM     nnnXE4U l        XE4$ s  snnf s  snnf )zMCompute or obtain the cached values for subtest errors and non-subtest skips.r   r   r"   z2This workaround only should be used in Python 3.10)
r   r   r+   r   r   r   r   errorsr   rT   )r=   r   rW   yr   non_subtest_skipss         r5   r   )TestCaseFunction._obtain_errors_and_skips  s    *') 	
@	
) ((4000 ..55
5!& +, QF5 	 
 ..66
6a* QF6 	 

 *8(K%00

s   C8C=C*CC)r   r   r   r   )r   unittest.TestCaser   r   )r   _SysExcInfoTyper   r   )r   r:  r   r;  r   r   )r   r:  rt   r   r   boolr   r   )r   )r   r:  r   r;  rt   r   r   r   r`   )r   r:  rt   z"twisted.trial.unittest.Todo | Noner   r   )r   r:  r   floatr   r   )r   z*_pytest._code.ExceptionInfo[BaseException]r   z_pytest._code.Traceback)r   r
   r-  r   r   z^ExceptionInfo[BaseException] | tuple[type[BaseException], BaseException, TracebackType] | Noner   r   )r   ztuple[list[Any], list[Any]])r   r   r   r   r   failfastr   __annotations__r   propertyr   rv   rw   r   r   r   r   r   r   r   r   r   r   rX   r  r   r   r   __classcell__)r   s   @r5   rQ   rQ      sj   JHHLHEL*  U AD%)%7F%	%%)%7F%	% TX)36LP	J 		-#	- $	- 		-
 
	- 6:-#- 3- 
	--B	A		 	8N8N 8N	8N 
8Nt1 1r@   rQ   T)tryfirstc                  ^ [        U [        5      (       a4  U R                  (       a#  U R                  R                  S5      Ul         U?[        R                  R                  S5      nU(       a  UR                  (       au  [        UR                  R                  UR                  5      (       aE  UR                  m[        S    R                  U4S jUR                  5      nUR                  Ul        g g g g ! [         a     Nf = f)Nr   r(   c                 @   > [        [        T R                  5      5      $ r`   )r   r   r   )r   s   r5   rb   +pytest_runtest_makereport.<locals>.<lambda>  s    c'--6H1Ir@   )r   rQ   r   popr   r  AttributeErrorr+   r,   rR   r   SkipTestr   	from_callr  )r  r  r(   call2r   s       @r5   r'  r'    s    $())====,,Q/DLK {{z*HDLLZ0B0BHDUDU%V%V,,(()I499U}} &WLx " s   	C9 9
DDc                .    [        [        U SS5      5      $ )zDReturn True if the given object has been marked with @unittest.skip.__unittest_skip__F)r<  rG   r;   s    r5   rH   rH     s    0%899r@   c                 n    [        5       [        R                  La  SSKJn   SSKJn  U" [        U 5        gg)zRRegister the TestCaseFunction class as an IReporter if twisted.trial is available.r   )	IReporter)classImplementsN)_get_twisted_versionTwistedVersionNotInstalledtwisted.trial.itrialrN  zope.interfacerO  rQ   )rN  rO  s     r5   pytest_configurerU    s*    ^%@%@@22()4	 Ar@   c                  B    \ rS rSrSr\" 5       r\" 5       r\" 5       rSr	g)rQ  i  z~
The Twisted version installed in the environment.

We have different workarounds in place for different versions of Twisted.
ra   N)
r   r   r   r   __doc__r   	Version24	Version25rR  r   ra   r@   r5   rQ  rQ    s     II6Lr@   rQ  c                 &   S[         R                  ;  a  [        R                  $ SS Kn SS KnU R                  R                  S5      nUR                  R                  U5      nUR                  S::  a  [        R                  $ [        R                  $ )NrF   r   twisted   )r+   r,   rQ  rR  importlib.metadatapackaging.versionmetadataversionparsemajorrX  rY  )	importlib	packagingversion_strr`  s       r5   rP  rP  ,  sr      s{{2***$$,,Y7K%%k2G}}''''''r@   _twisted_raw_excinfo)wrapperc              #  <  ^#    [        5       [        R                  L ah  SS KJs  Jn  UR                  R                  m SU4S jjn[        R                  " 5        nUR                  UR                  SU5        S v sS S S 5        $ S v $ ! , (       d  f       g = f7f)Nr   c                
  > Uc  [         R                  " 5       nO-Uc  [        U5      nUc  [         R                  " 5       S   nX!U4n[        U [        [        U5      5         T" XX#US9  g ! [         a    T" XX#5         g f = f)Nr!   )captureVars)r+   r   r   r
  TWISTED_RAW_EXCINFO_ATTRr$  r   )r=   	exc_valueexc_typeexc_tbrj  raw_exc_infooriginal__init__s         r5   store_raw_exception_info9pytest_runtest_protocol.<locals>.store_raw_exception_infoM  s      "||~##IH> \\^A.F (V<D2E,4GHD X;  D (CDs   #A, ,BB__init__)NNNN)rP  rQ  rX  twisted.python.failurepythonfailureFailurers  r   contextr
  )r  r4   rq  patcherrp  s       @r5   pytest_runtest_protocolrz  E  s{     !9!99++ ::.. KO	D&   "gOOBJJ
4LM #" 	 #"s   AB!B=B
BBc                6   [        5       nU[        R                  L a  U $ U[        R                  L a9  [	        U [
        5      (       a"  [        U [
        5      n[        U [
        5        U$ U $ U[        R                  L a  [        U [        5      (       a{  SSKn[        XR                  R                  R                  5      (       aI  U R                  nUc  [         R"                  " 5       S   n[%        U R&                  5      U R&                  U4$ U $  SU 35       e)z
Twisted passes a custom Failure instance to `addError()` instead of using `sys.exc_info()`.
Therefore, if `rawexcinfo` is a `Failure` instance, convert it into the equivalent `sys.exc_info()` tuple
as expected by pytest.
r   Nr!   zUnexpected Twisted version: )rP  rQ  rR  rX  hasattrrk  rG   r  rY  r   r   rt  ru  rv  rw  __traceback__r+   r   r   r   )r   twisted_versionsaved_exc_infor[  tbs        r5   r   r   g  s     +,O.555 	N44	4 :788$Z1IJNJ 89!!	N44	4j-00)*nn&<&<&D&DEE--:*BJ,,-z/?/?CC 	G4_4EFFur@   )r3   zModule | Classr)   r   r*   objectr   zUnitTestCase | None)r  r   r  zCallInfo[None]r   r   )r   r<  r   )r   rQ  )r  r   r   zIterator[None])r   z_SysExcInfoType | BaseExceptionr   r;  )HrW  
__future__r   collections.abcr   r   r   r   enumr   r	   r/   r+   r   typestypingr
   r   r(   r   r   r   _pytest._coder   _pytest.compatr   r   _pytest.configr   _pytest.fixturesr   _pytest.monkeypatchr   _pytest.nodesr   r   _pytest.outcomesr   r   r   r   _pytest.pythonr   r   r   _pytest.runnerr   r   _pytest.subtestsr   r    r   exceptiongroupr%   r&   twisted.trial.unittestr[  r$  r   r   r;  r6   r1   rQ   r'  rH   rU  rQ  rP  rk  rz  r   ra   r@   r5   <module>r     s|   : " $ % $ $    
         ' ' , # + + #  ! ! ! "   # ! # 6 + * BQ'!-#! 
$}
}e.A.A
AB CC%(C/5CC(T
5 T
nS1x S1l 
4% %$:
5T (, 2  
$ B&G/&G&Gr@   