
    [FiQ                        d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dl"m#Z# d d l$m%Z% d d!l&m'Z' d d"l&m(Z( d d#l)m*Z* erd d$l+m,Z, d% Z- ed&d'(      Z. G d) d'      Z/d*e0d+ee/   d,efd-Z1e	 G d. d/e/             Z2e	 G d0 d1e/             Z3 G d2 d3e!      Z4d4ee3e2f   d,eee0ef      fd5Z5d6ee0ef   d,eee3e2f      fd7Z6d4e/d,ee0ef   fd8Z7d9ee0ef   d,ee0ef   fd:Z8y);    N)StringIO)pprint)Any)cast)Dict)final)Iterable)Iterator)List)Literal)Mapping)NoReturn)Optional)Tuple)Type)TYPE_CHECKING)TypeVar)Union)ExceptionChainRepr)ExceptionInfo)ExceptionRepr)	ReprEntry)ReprEntryNative)ReprExceptionInfoReprFileLocation)ReprFuncArgs)
ReprLocalsReprTraceback)TerminalRepr)TerminalWriter)Config)	Collector)Item)skip)CallInfoc                     	 | j                   S # t        $ rJ | j                  } dj                  |d   d d  }dj                  |d   |d   ||d         x| _         }|cY S w xY w)Nz{}.{}.{}version_info   z[{}] {} -- Python {} {}idsysplatform
executable)_workerinfocacheAttributeError
workerinfoformat)nodedverss       a/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/_pytest/reports.pygetworkerinfoliner7   -   s    $$$ OOj>!22A!67$=$D$DdGQ}%sAlO%
 	
 s    AA! A!_R
BaseReport)boundc                   &   e Zd ZU ee   ed<   eeeee   ef      ed<   ede	e
   eeeef   eef   ed<   eeeef      ed<   eed<   ed   ed<   d	ed
dfdZerded
efdZded
dfdZded
eeeef      fdZed
efd       Zed
efd       Zed
efd       Zed
efd       Zed
efd       Zed
efd       Zed
efd       Zed
efd       Zed
efd       Z ed
ee   fd       Z!de"fdZ#d
e$eef   fdZ%e&de'e(   d e$ee)f   d
e(fd!       Z*y)"r9   whenlocationNlongreprsectionsnodeidpassedfailedskippedoutcomekwreturnc                 :    | j                   j                  |       y N)__dict__update)selfrF   s     r6   __init__zBaseReport.__init__F   s    R     keyc                      y rI    )rL   rO   s     r6   __getattr__zBaseReport.__getattr__K   s    rN   outc                 B   t        | d      r(t        | j                        }|r|j                  |       | j                  }|y t        |d      r"t        t        |      }|j                  |       y 	 t        |      }|j                  |       y # t        $ r d}Y w xY w)Nr2   
toterminalz<unprintable longrepr>)
hasattrr7   r2   liner>   r   r!   rU   strUnicodeEncodeError)rL   rS   worker_infor>   longrepr_terminalr5   s         r6   rU   zBaseReport.toterminalM   s    4 +DII6K%==8\* $\8 <((--M HHQK & -,-s   3B BBprefixc              #   d   K   | j                   D ]  \  }}|j                  |      s||f  y wrI   )r?   
startswith)rL   r\   namecontents       r6   get_sectionszBaseReport.get_sectionsa   s3     !]] 	&MD'v&go%	&s   $0	0c                     t               }t        |      }d|_        | j                  |       |j	                         }|j                         S )zRead-only property that returns the full string representation of
        ``longrepr``.

        .. versionadded:: 3.0
        F)r   r"   	hasmarkuprU   getvaluestrip)rL   filetwexcs       r6   longreprtextzBaseReport.longreprtextf   s?     zD!mmoyy{rN   c                 P    dj                  d | j                  d      D              S )z_Return captured log lines, if log capturing is enabled.

        .. versionadded:: 3.5
        
c              3   &   K   | ]	  \  }}|  y wrI   rQ   .0r\   r`   s      r6   	<genexpr>z$BaseReport.caplog.<locals>.<genexpr>z   s      
)G
   zCaptured logjoinra   rL   s    r6   caplogzBaseReport.caplogt   s-     yy 
-1->->~-N
 
 	
rN   c                 P    dj                  d | j                  d      D              S )zbReturn captured text from stdout, if capturing is enabled.

        .. versionadded:: 3.0
         c              3   &   K   | ]	  \  }}|  y wrI   rQ   rm   s      r6   ro   z'BaseReport.capstdout.<locals>.<genexpr>         
)G
rp   zCaptured stdoutrq   rs   s    r6   	capstdoutzBaseReport.capstdout~   .     ww 
-1->->?P-Q
 
 	
rN   c                 P    dj                  d | j                  d      D              S )zbReturn captured text from stderr, if capturing is enabled.

        .. versionadded:: 3.0
        rv   c              3   &   K   | ]	  \  }}|  y wrI   rQ   rm   s      r6   ro   z'BaseReport.capstderr.<locals>.<genexpr>   rx   rp   zCaptured stderrrq   rs   s    r6   	capstderrzBaseReport.capstderr   rz   rN   c                      | j                   dk(  S )zWhether the outcome is passed.rB   rE   rs   s    r6   rB   zBaseReport.passed        ||x''rN   c                      | j                   dk(  S )zWhether the outcome is failed.rC   r   rs   s    r6   rC   zBaseReport.failed   r   rN   c                      | j                   dk(  S )zWhether the outcome is skipped.rD   r   rs   s    r6   rD   zBaseReport.skipped   s     ||y((rN   c                 >    | j                   j                  d      d   S )z3The path portion of the reported node, as a string.z::r   )r@   splitrs   s    r6   fspathzBaseReport.fspath   s     {{  &q))rN   c                      y)a6  **Experimental** Whether this report should be counted towards the
        totals shown at the end of the test session: "1 passed, 1 failure, etc".

        .. note::

            This function is considered **experimental**, so beware that it is subject to changes
            even in patch releases.
        TrQ   rs   s    r6   count_towards_summaryz BaseReport.count_towards_summary   s     rN   c                 @    | j                   | j                   \  }}}|S y)a  **Experimental** The head line shown with longrepr output for this
        report, more commonly during traceback representation during
        failures::

            ________ Test.foo ________


        In the example above, the head_line is "Test.foo".

        .. note::

            This function is considered **experimental**, so beware that it is subject to changes
            even in patch releases.
        N)r=   )rL   r   linenodomains       r6   	head_linezBaseReport.head_line   s&      ==$%)]]"FFFMrN   configc                 H    |j                   j                  | |      \  }}}|S )N)reportr   )hookpytest_report_teststatus)rL   r   	_category_shortverboses        r6   _get_verbose_wordzBaseReport._get_verbose_word   s/    %+[[%I%I &J &
"	67 rN   c                     t        |       S )zReturn the contents of this report as a dict of builtin entries,
        suitable for serialization.

        This was originally the serialize_report() function from xdist (ca03269).

        Experimental method.
        )_report_to_jsonrs   s    r6   _to_jsonzBaseReport._to_json   s     t$$rN   cls
reportdictc                 (    t        |      } | di |S )a  Create either a TestReport or CollectReport, depending on the calling class.

        It is the callers responsibility to know which class to pass here.

        This was originally the serialize_report() function from xdist (ca03269).

        Experimental method.
        rQ   )_report_kwargs_from_json)r   r   kwargss      r6   
_from_jsonzBaseReport._from_json   s     **5}V}rN   )+__name__
__module____qualname__r   rX   __annotations__r   intr   r   BaseExceptionr!   r   r   r   rM   r   rR   r"   rU   r
   ra   propertyri   rt   ry   r}   boolrB   rC   rD   r   r   r   r#   r   r   r   classmethodr   r8   objectr   rQ   rN   r6   r9   r9   <   s8   
3-uS(3-4566mM*E#sC-,@#|S  5c?##K233!S !T ! 33333n  (&3 &8E#s(O+D &
 c   
 
 
 
3 
 
 
3 
 
 ( ( ( ( ( ( ) ) ) * * * 	t 	 	 8C=  ( %$sCx. % 
R 
d3;.? 
B 
 
rN   	type_namereport_classrG   c                     d}t               }t        d|       t        d| z  |       t        d|z  |       t        ||       t        d|z  |       t        d|       t        |j                               )Nz+https://github.com/pytest-dev/pytest/issueszd----------------------------------------------------------------------------------------------------)streamz.INTERNALERROR: Unknown entry type returned: %szreport_name: %szPlease report this bug at %s)r   r   RuntimeErrorrd   )r   r   r   urlr   s        r6   _report_unserialization_failurer      sq     8CZF
9V$
;iGPVW
|+F;
:f%
)C/?
9V$
v(
))rN   c                       e Zd ZU dZdZeed<   	 	 	 	 	 ddedeeee	   ef   de
eef   ded	   d
edee   eee	ef   eef   ded   deeeef      dedededeeeeef         ddfdZdefdZededddd fd       Zy)
TestReportzBasic test report object (also used for setup and teardown calls if
    they fail).

    Reports can contain arbitrary extra attributes.
    FwasxfailNr@   r=   keywordsrE   rA   r>   r<   )setupcallteardownr?   durationstartstopuser_propertiesrG   c                     || _         || _        || _        || _        || _        || _        t        |xs g       | _        t        |      | _        || _	        |	| _
        |
| _        | j                  j                  |       y rI   )r@   r=   r   rE   r>   r<   listr   r?   r   r   r   rJ   rK   )rL   r@   r=   r   rE   r>   r<   r?   r   r   r   r   extras                r6   rM   zTestReport.__init__   s    $  9A ,4  ! 	  $O$9r: X  ( "
	U#rN   c           	          d| j                   j                   d| j                  d| j                  d| j                  d	S )N< z when=	 outcome=>)	__class__r   r@   r<   rE   rs   s    r6   __repr__zTestReport.__repr__<  s?    4>>**+1T[[O6$))iX\XdXdWgghiirN   itemr   zCallInfo[None]c                    |j                   }|dk7  sJ |j                  }|j                  }|j                  }|j                  D ci c]  }|d }}|j
                  }	g }
|j
                  sd}d}n(t        |	t              sd}|	}nt        |	j                  t        j                        rd}|	j                         }|J d       |	j                  j                  r@|j                         dd \  }}|J t        j                  |      |dz   |j                   f}n}t#        |j$                        |j&                  |j                   f}nPd}|j                   d	k(  r|j)                  |	      }n-|j+                  |	|j,                  j/                  d
d            }|j0                  D ]  \  }}}|
j3                  d| d| |f       !  | |j4                  |j6                  |||||
||||j8                        S c c}w )zCreate and fill a TestReport with standard item and call info.

        :param item: The item.
        :param call: The call info.
        collect   rB   NrC   rD   z=There should always be a traceback entry for skipping a test.   r   tbstyleauto)stylez	Captured r   )r   )r<   r   r   r   r   excinfo
isinstancer   valuer&   	Exception_getreprcrash_use_item_location
reportinfoosr   messagerX   pathr   repr_failure_repr_failure_pyr   	getoption_report_sectionsappendr@   r=   r   )r   r   r   r<   r   r   r   xr   r   r?   rE   r>   rr   rW   rwhenrO   r`   s                      r6   from_item_and_callzTestReport.from_item_and_call?  s    yyy   ==

yy"&--0QAqD00,,||>FG   g}5""GMM4>>:#))+MSRS!==33!%!22A!6JD$+++!yyq!))CH #AFFQXXqyyAH"99&#009H#44t{{'<'<Y'O  5  H $(#8#8 	BE3OOyQug6@A	BKKMM 00
 	
M 1s   
G9)rQ   r   r   r   N)r   r   r   __doc____test__rX   r   r   r   r   r   r   r   r   r   r   r!   r	   floatr   rM   r   r   r%   r   rQ   rN   r6   r   r      sB    H M /1BF:$:$ Xc]C/0:$ #s(#	:$
 67:$ -.c3m0Dc<W
:$ 12:$ 5c?+:$ :$ :$ :$ "(5f+=">?:$  
!:$xj# j >
d >
2B >
| >
 >
rN   r   c                       e Zd ZdZdZ	 ddedddedee   e	ee
ef   eef   deeeeef         d	ee	eef      d
dfdZed
ee	eee
   ef      fd       Zd
efdZy)CollectReportzSCollection report object.

    Reports can contain arbitrary extra attributes.
    r   r@   rE   z&Literal['passed', 'failed', 'skipped']r>   Nresultr?   rG   c                     || _         || _        || _        |xs g | _        t	        |      | _        | j                  j                  |       y rI   )r@   rE   r>   r   r   r?   rJ   rK   )rL   r@   rE   r>   r   r?   r   s          r6   rM   zCollectReport.__init__  sI       ! l XU#rN   c                 4    | j                   d | j                   fS rI   )r   rs   s    r6   r=   zCollectReport.location  s     T4;;//rN   c                 h    d| j                   dt        | j                         d| j                  dS )Nz<CollectReport z lenresult=r   r   )r@   lenr   rE   rs   s    r6   r   zCollectReport.__repr__  s4     {3t{{;K:LIVZVbVbUeefggrN   )rQ   )r   r   r   r   r<   rX   r   r   r   r   r   r!   r   r   r%   r$   r	   rM   r   r=   r   rQ   rN   r6   r   r     s    
 D /1$$ :$ -.c3m0Dc<W
	$ eD)O456$ 5c?+$ 
$> 0	%Xc]C/0	10 0
h# hrN   r   c                   ,    e Zd ZdeddfdZdeddfdZy)CollectErrorReprmsgrG   Nc                     || _         y rI   )r>   )rL   r   s     r6   rM   zCollectErrorRepr.__init__  s	    rN   rS   c                 >    |j                  | j                  d       y )NT)red)rW   r>   )rL   rS   s     r6   rU   zCollectErrorRepr.toterminal  s    D)rN   )r   r   r   rX   rM   r"   rU   rQ   rN   r6   r   r     s(    C D *n * *rN   r   r   c                     t        | t        t        f      r+| j                         }| j                  j
                  |d<   |S y )N$report_type)r   r   r   r   r   r   )r   datas     r6   pytest_report_to_serializabler     s=     &:}56 %//88^rN   r   c                     d| v rS| d   dk(  rt         j                  |       S | d   dk(  rt        j                  |       S J dj                  | d                y )Nr   r   r   z(Unknown report_type unserialize data: {})r   r   r   r1   )r   s    r6   pytest_report_from_serializabler     so     </((...!_4 ++D11	
@GG 
 	
u rN   c                    dt         t        t        f   dt        t        t
        f   fddt        dt        t        t
        f   ffddt        t           dt        t        t        t
        f      fddt        dt        t        t
        f   ffd	}| j                  j                         }t        | j                  d
      rQt        | j                  d      r"t        | j                  d      r ||       |d<   n(t	        | j                        |d<   n| j                  |d<   |D ]F  }t        ||   t        j                         rt        j"                  ||         ||<   <|dk(  sBd||<   H |S )zReturn the contents of this report as a dict of builtin entries,
    suitable for serialization.

    This was originally the serialize_report() function from xdist (ca03269).
    entryrG   c                     t        j                  |       }|j                         D ]*  \  }}t        |d      st        j                  |      ||<   , t	        |       j
                  |d}|S )NrJ   )typer   )dataclassesasdictitemsrV   r   r   )r   r   rO   r   
entry_datas        r6   serialize_repr_entryz-_report_to_json.<locals>.serialize_repr_entry  sg     !!%(**, 	6JCuj)'..u5S		6 #5k22DA
rN   reprtracebackc                     t        j                  |       }| j                  D cg c]
  } |       c}|d<   |S c c}w )Nreprentries)r   r   r   )r   r   r   r   s      r6   serialize_repr_tracebackz1_report_to_json.<locals>.serialize_repr_traceback  sE    ##M2-:-F-F!
() #!
} !
s   <	reprcrashc                 2    | t        j                  |       S y rI   )r   r   )r  s    r6   serialize_repr_crashz-_report_to_json.<locals>.serialize_repr_crash  s      %%i00rN   repc                 `   | j                   J t        t        | j                         } |j                         |j                        |j
                  d}t        |t              r?g |d<   |j                  D ])  \  }}}|d   j                   |       |      |f       + |S d |d<   |S )N)r  r   r?   chain)
r>   r   r   r  r   r?   r   r   r  r   )r  r>   r   repr_traceback
repr_crashdescriptionr  r  s         r6   serialize_exception_longreprz5_report_to_json.<locals>.serialize_exception_longrepr  s    ||'''s||4-h.@.@A5h6L6LM ))"

 h 23 F7O;C>> 7
Kw&&0@,Z8#  #F7OrN   rU   r>   r   N)r   r   r   r   rX   r   r    r   r   r9   rJ   copyrV   r>   r   r   PathLiker   )r   r  r3   r_   r  r   r  s       @@@r6   r   r     sF   Y/0	c3h $sCx. ,-	$sCx.	!* c3h . 	Av-6??O4OO[:
 9@AjM0AjM* agr{{+ii$(AdGXAdG	
 HrN   r   c                      fdfd}dt         t        t        t        f      fd} d   rd d   v rd d   v r | d   d         } | d   d         } d   d   r?g } d   d   D ]&  \  }}}|j	                   ||       ||      |f       ( t        |      }	nt        ||	      }	 d   d
   D ]  }
 |	j                  |
   |	 d<    S )zReturn **kwargs that can be used to construct a TestReport or
    CollectReport instance.

    This was originally the serialize_report() function from xdist (ca03269).
    c                 &   | d   }| d   }|dk(  rZd }d }d }|d   rt        di |d   }|d   rt        di |d   }|d   rt        |d   d         }t        |d   ||||d   	      }|S |d
k(  rt	        |d         }|S t        |t               S )Nr   r   r   reprfuncargsreprfileloc
reprlocalslinesr   )r  r  r  r  r   r   rQ   )r   r   r   r   r   r   r   )r   r   
entry_typer  r  r  	reprentryr   s          r6   deserialize_repr_entryz8_report_kwargs_from_json.<locals>.deserialize_repr_entry$  s    &!'
$LKJN#+Cd>.BCM".Em1DEL!'\(:7(CD
;D7m)%'7m<I 	 ,,'W6I  ,J
JOrN   c                 \    | d   D cg c]
  } |       c}| d<   t        di | S c c}w )Nr   rQ   r   )repr_traceback_dictr   r  s     r6   deserialize_repr_tracebackz<_report_kwargs_from_json.<locals>.deserialize_repr_traceback?  s?    /B=/Q.
*+"1%.
M* 3233.
s   )repr_crash_dictc                     | t        di | S y )NrQ   r   )r  s    r6   deserialize_repr_crashz8_report_kwargs_from_json.<locals>.deserialize_repr_crashE  s    &#6o66rN   r>   r  r   r  )r   r  r?   )r   r   rX   r   r   r   r   
addsection)r   r  r  r   r  r  repr_traceback_datarepr_crash_datar
  exception_infosectionr  s   `          @r6   r   r     s5   64c3h0H  	::j11z*552z"?3
 +:j+A++NO	j!'*EEOFF 	A#_k 23FG.?#	 #5)  /+#N
 "*-j9 	0G%N%%w/	0!/
:rN   )9r   ior   r   r   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   _pytest._code.coder   r   r   r   r   r   r   r   r   r    r!   _pytest._ior"   _pytest.configr#   _pytest.nodesr$   r%   _pytest.outcomesr&   _pytest.runnerr'   r7   r8   r9   rX   r   r   r   r   r   r   r   r   rQ   rN   r6   <module>r*     s     	                   1 , , ( . 0 / + ) , + & ! #  ! '	 T&f fR**"&z"2** J
 J
 J
Z .hJ .h .hb*| *-+,d38n
sCx.eM:-./FJ F4S> FRPc3h PDcN PrN   