
    i1K                       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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*r*\RV                  S	S S:  a  SSK,J-r-  \(       a  SS	K.r.SS	K/r0\\1\2\3   \3\Rh                  4   \1S   4   r5        S/S jr6 " S S \%5      r7 " S! S"\&5      r8\" S#S$9S0S% j5       r9S1S& jr:S2S' jr; " S( S)\
5      r<S3S* jr=S+r>\" S#S,9S4S- j5       r?    S5S. jr@g	)6z4Discover and run std-library "unittest" style tests.    )annotations)Callable)	Generator)Iterable)Iterator)auto)EnumN)TYPE_CHECKING)Union)is_async_function)hookimpl)FixtureRequest)MonkeyPatch)	Collector)Item)exit)fail)skip)xfail)Class)Function)Module)CallInfo   )      )ExceptionGroup)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
issubclassTestCase	Exceptioninspect
isabstractUnitTestCasefrom_parent)	collectorr    r!   uts       O/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/_pytest/unittest.pypytest_pycollect_makeitemr.   4   sn    [[$ #{{++ , ###Ic#BB  s   -A! !
A.-A.c                  <    \ rS rSrSrS rS	S jrS
S jrS
S jrSr	g)r)   H   Tc                $    U R                  S5      $ )NrunTestr!   selfs    r-   newinstanceUnitTestCase.newinstanceM   s     xx	""    c              #    #    SSK Jn  U R                  n[        USS5      (       d  g [	        U5      nU(       d2  U R                  U5        U R                  U5        U R                  5         U R                  R                  R                  U R                  5       U R                  5        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__TF)r    r2   twisted.trial.unittest)r   r:   r!   getattr_is_skipped'_register_unittest_setup_method_fixture&_register_unittest_setup_class_fixture_register_setup_class_fixturesession_fixturemanagerparsefactoriesr6   nodeidgetTestCaseNamesTestCaseFunctionr*   r"   r#   getr%   r2   )
r5   r:   clsskippedloaderfoundsomethingr    xruntestr,   s
             r-   collectUnitTestCase.collectU   sK    'hhsJ--c"88=77<..0$$33D4D4D4FT++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U R                  R                  R                  STR                   3UU R
                  S	S
S9  g)zKRegister an auto-use fixture to invoke setUpClass and
tearDownClass (#517).
setUpClassNtearDownClassdoClassCleanupsc                     g N rW   r8   r-   <lambda>EUnitTestCase._register_unittest_setup_class_fixture.<locals>.<lambda>{   s    $r8   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)r=   lenr   )	exc_infos_exc
exceptionsrI   s       r-   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  J  >#    U R                   n[        U5      (       a*  UR                  n[        R                  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)rI   r>   __unittest_skip_why__pytestr   r&   )requestrI   reasoncleanuprb   setupteardowns      r-   unittest_setup_class_fixtureYUnitTestCase._register_unittest_setup_class_fixture.<locals>.unittest_setup_class_fixture   s      ++C322kk++Ft+LL G .'J	+- ! I/1 	+-s6   A
B#A3 B#
B $B#3BB#B  B#_unittest_setUpClass_fixture_classTr    funcrE   scopeautousereturnNoneri   r   rw   zGenerator[None]r=   rB   rC   _register_fixture__qualname__rE   )r5   rI   rn   rk   rb   rl   rm   s    ` @@@@r-   r@   3UnitTestCase._register_unittest_setup_class_fixturet   s     \4036=X-#0,?	R	.#	.	. 	.0 	$$6601A1A0BC-;; 	7 	
r8   c                   ^^ [        USS5      m[        USS5      mTc  Tc  g    S	UU4S jjnU R                  R                  R                  SUR                   3UU R
                  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                  R                  USS9eTb  T" XR                  5        S v   Tb  T" XR                  5        g g 7fre   )instancer>   rg   rh   r   r&   function)ri   r5   rj   rl   rm   s      r-   unittest_setup_method_fixture[UnitTestCase._register_unittest_setup_method_fixture.<locals>.unittest_setup_method_fixture   ss      ##D4  33kk++Ft+LL d,,-#//0 $s   A7A:_unittest_setup_method_fixture_r   Trr   ry   rz   )r5   rI   r   rl   rm   s      @@r-   r?   4UnitTestCase._register_unittest_setup_method_fixture   s     ^T23 148=X-	1#	1	1 	1 	$$66233C3C2DE.;; 	7 	
r8   rW   N)rw   zIterable[Item | Collector])rI   typerw   rx   )
__name__
__module__r|   __firstlineno__
nofuncargsr6   rO   r@   r?   __static_attributes__rW   r8   r-   r)   r)   H   s     J#M>6
p
r8   r)   c                  (  ^  \ 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 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rU =r$ )"rG      TNz7list[_pytest._code.ExceptionInfo[BaseException]] | None_excinfoc                    [        U R                  [        5      (       d   eU R                  R                  U R                  5      $ rV   )
isinstanceparentr)   r!   r    r4   s    r-   _getinstanceTestCaseFunction._getinstance   s0    $++|4444{{tyy))r8   c                    U R                   $ rV   )r   r4   s    r-   	_testcaseTestCaseFunction._testcase   s    }}r8   c                0   > S U l         [        TU ]	  5         g rV   )_explicit_tearDownsuperrl   r5   	__class__s    r-   rl   TestCaseFunction.setup   s    =Ar8   c                |   > U R                   b  U R                  5         S U l         S U l        U ?[        TU ]  5         g rV   )r   _obj	_instancer   rm   r   s    r-   rm   TestCaseFunction.teardown   s:    "".##%&*D#	Nr8   c                    g rV   rW   r5   testcases     r-   	startTestTestCaseFunction.startTest       r8   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:

 Fpytracez6ERROR: Unknown Incompatible Exception representation:
r   )_handle_twisted_exc_info_pytest_codeExceptionInfoBaseExceptionfrom_exc_infovalue	traceback	TypeErrorformat_exceptioninsertr   joinr&   KeyboardInterruptfrom_current__dict__
setdefaultappend)r5   
rawexcinfoexcinfor_   valuess        r-   _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)Nr\   )r   r   r&   msgr   r   r5   r   r   s      r-   addErrorTestCaseFunction.addError  sR    	*Q-88Z]&&' 	$  		s   :A 
AAc                &    U R                  U5        g rV   )r   r   s      r-   
addFailureTestCaseFunction.addFailure  s     	$r8   c                     [         R                  R                  USS9e! [        R                   a'    U R                  [        R
                  " 5       5         g f = fre   )rh   r   r&   r   r"   exc_info)r5   r   rj   s      r-   addSkipTestCaseFunction.addSkip  sH    	-++''4'HH~~ 	-S\\^,	-s     8AAc                     [        [        U5      5        g ! [         R                   a'    U R                  [        R
                  " 5       5         g f = frV   )r   strr&   r   r"   r   )r5   r   r   rj   s       r-   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   )rj   r   r&   r   r"   r   )r5   r   rj   r   s       r-   addUnexpectedSuccess%TestCaseFunction.addUnexpectedSuccess+  sW    
 #R''C	-e$~~ 	-S\\^,	-s   
( 8A#"A#c                    g rV   rW   r   s     r-   
addSuccessTestCaseFunction.addSuccess9  r   r8   c                    g rV   rW   r   s     r-   stopTestTestCaseFunction.stopTest<  r   r8   c                    g rV   rW   )r5   r   elapseds      r-   addDurationTestCaseFunction.addDuration?  r   r8   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 rV   rW   )argss    r-   rX   *TestCaseFunction.runtest.<locals>.<lambda>Y  s    Dr8   )_pytest.debuggingr   r   r   r!   r   r   r)   r>   config	getoptionr   r   setattrr    delattr)r5   r   r   rJ   s       r-   rN   TestCaseFunction.runtestB  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_globalsrH   )rM   s    r-   rX   4TestCaseFunction._traceback_filter.<locals>.<lambda>h  s    !''++//==r8   )r   _traceback_filterfilter)r5   r   r   
ntracebackr   s       r-   r   "TestCaseFunction._traceback_filterc  s7     G-g6	%%=

 "Jr8   )r   r   rv   )r   unittest.TestCaserw   rx   )r   _SysExcInfoTyperw   rx   )r   r   r   r   rw   rx   )r   r   rj   r   rw   rx   )r   )r   r   r   r   rj   r   rw   rx   rV   )r   r   rj   z"twisted.trial.unittest.Todo | Nonerw   rx   )r   r   r   floatrw   rx   )r   z*_pytest._code.ExceptionInfo[BaseException]rw   z_pytest._code.Traceback)r   r   r|   r   r   r   __annotations__r   propertyr   rl   rm   r   r   r   r   r   r   r   r   r   r   rN   r   r   __classcell__)r   s   @r-   rG   rG      s   JHLHEL*  
 AD%)%7F%	%%)%7F%	%
- 		-#	- $	- 		-
 
	- 6:-#- 3- 
	--B	A		 	 	r8   rG   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                 V   > [         R                  " [        T R                  5      5      $ rV   )rh   r   r   r   )r   s   r-   rX   +pytest_runtest_makereport.<locals>.<lambda>  s    FKKGMM 23r8   )r   rG   r   popr   r   AttributeErrorr"   r#   rH   r   SkipTestr   	from_callwhen)itemcallr   call2r   s       @r-   pytest_runtest_makereportr
  o  s    $())====,,Q/DLK {{z*HDLLZ0B0BHDUDU%V%V,,((3TYY
 }} &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)boolr=   r3   s    r-   r>   r>     s    0%899r8   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.itrialr  zope.interfacer  rG   )r  r  s     r-   pytest_configurer    s*    ^%@%@@22()4	 Ar8   c                  B    \ rS rSrSr\" 5       r\" 5       r\" 5       rSr	g)r  i  z~
The Twisted version installed in the environment.

We have different workarounds in place for different versions of Twisted.
rW   N)
r   r   r|   r   __doc__r   	Version24	Version25r  r   rW   r8   r-   r  r    s     II6Lr8   r  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                  $ )Nr<   r   twisted   )r"   r#   r  r  importlib.metadatapackaging.versionmetadataversionparsemajorr  r  )	importlib	packagingversion_strr!  s       r-   r  r    sr      s{{2***$$,,Y7K%%k2G}}''''''r8   _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_ATTRtupler   )r5   	exc_valueexc_typeexc_tbr+  raw_exc_infooriginal__init__s         r-   store_raw_exception_info9pytest_runtest_protocol.<locals>.store_raw_exception_info  s      "||~##IH> \\^A.F (V<D2E,4GHD X;  D (CDs   #A, ,BB__init__)NNNN)r  r  r  twisted.python.failurepythonfailureFailurer5  r   contextr   )r  r,   r3  patcherr2  s       @r-   pytest_runtest_protocolr<    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: )r  r  r  r  hasattrr,  r=   r   r  r   r   r6  r7  r8  r9  __traceback__r"   r   r   r   )r   twisted_versionsaved_exc_infor  tbs        r-   r   r     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Fur8   )r+   zModule | Classr    r   r!   objectrw   zUnitTestCase | None)r  r   r  zCallInfo[None]rw   rx   )rw   r  rv   )rw   r  )r  r   rw   zIterator[None])r   z_SysExcInfoType | BaseExceptionrw   r   )Ar  
__future__r   collections.abcr   r   r   r   enumr   r	   r'   r"   r   typestypingr
   r   _pytest._coder   _pytest.compatr   _pytest.configr   _pytest.fixturesr   _pytest.monkeypatchr   _pytest.nodesr   r   _pytest.outcomesr   r   r   r   _pytest.pythonr   r   r   _pytest.runnerr   rh   version_infoexceptiongroupr   r   twisted.trial.unittestr  r-  r   r   TracebackTyper   r.   r)   rG   r
  r>   r  r  r  r,  r<  r   rW   r8   r-   <module>rV     sl   : " $ % $ $    
       , # + + #  ! ! ! "   # ! #  BQ'!-! 	$}
}e.A.A
AB	
CC%(C/5CC(@
5 @
Fax aH 
4% %,:
5T (, 2  
$ B&G/&G&Gr8   