
    F-PhS                    V   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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( erd d l)m*Z* d d!l+m,Z, d" Z- G d# d$          Z.d=d+Z/e G d, d-e.                      Z0e G d. d/e.                      Z1 G d0 d1e          Z2d>d5Z3d?d9Z4d@d:Z5dAd<Z6dS )B    )annotations)Iterable)Iterator)Mapping)SequenceN)StringIO)pprint)Any)cast)final)Literal)NoReturn)TYPE_CHECKING)ExceptionChainRepr)ExceptionInfo)ExceptionRepr)	ReprEntry)ReprEntryNative)ReprExceptionInfoReprFileLocation)ReprFuncArgs)
ReprLocalsReprTraceback)TerminalRepr)TerminalWriter)Config)	Collector)Item)fail)skip)Self)CallInfoc                    	 | j         S # t          $ rU | j        } dj        |d         d d          }d                    |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       O/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/reports.pygetworkerinfoliner4   ,   s    $$   Oj>!22A2!67$=$D$DdGQ}%sAlO%
 %
 	
 s   	 AA('A(c                     e Zd ZU ded<   ded<   ded<   ded<   d	ed
<   ded<   d2dZerd3dZd4dZd5dZe	d6d            Z
e	d6d            Ze	d6d            Ze	d6d            Ze	d7d            Ze	d7d             Ze	d7d!            Ze	d6d"            Ze	d7d#            Ze	d8d$            Zd9d*Zd:d,Zed;d0            Zd1S )<
BaseReport
str | Nonewhen"tuple[str, int | None, str] | NonelocationONone | ExceptionInfo[BaseException] | tuple[str, int, str] | str | TerminalReprlongreprzlist[tuple[str, str]]sectionsstrnodeid&Literal['passed', 'failed', 'skipped']outcomekwr
   returnNonec                :    | j                             |           d S N)__dict__update)selfrB   s     r3   __init__zBaseReport.__init__B   s    R         keyc                    d S rF    )rI   rL   s     r3   __getattr__zBaseReport.__getattr__G   s      rK   outr   c                z   t          | d          r+t          | j                  }|r|                    |           | j        }|d S t          |d          r,t          t          |          }|                    |           d S 	 t          |          }n# t          $ r d}Y nw xY w|                    |           d S )Nr/   
toterminalz<unprintable longrepr>)
hasattrr4   r/   liner<   r   r   rR   r>   UnicodeEncodeError)rI   rP   worker_infor<   longrepr_terminalr2   s         r3   rR   zBaseReport.toterminalI   s    4   	&+DI66K &%%%=F8\** 	 $\8 < <((------MM% - - -,-HHQKKKKKs   B B#"B#prefixIterator[tuple[str, str]]c              #  Z   K   | j         D ] \  }}|                    |          r||fV  !d S rF   )r=   
startswith)rI   rX   namecontents       r3   get_sectionszBaseReport.get_sections]   sJ      !] 	& 	&MD'v&& &go%%%	& 	&rK   c                    t                      }t          |          }d|_        |                     |           |                                }|                                S )zRead-only property that returns the full string representation of
        ``longrepr``.

        .. versionadded:: 3.0
        F)r   r   	hasmarkuprR   getvaluestrip)rI   filetwexcs       r3   longreprtextzBaseReport.longreprtextb   sN     zzD!!mmooyy{{rK   c                f    d                     d |                     d          D                       S )z_Return captured log lines, if log capturing is enabled.

        .. versionadded:: 3.5
        
c              3      K   | ]	\  }}|V  
d S rF   rN   .0rX   r]   s      r3   	<genexpr>z$BaseReport.caplog.<locals>.<genexpr>v   s7       
 
)G
 
 
 
 
 
rK   zCaptured logjoinr^   rI   s    r3   caplogzBaseReport.caplogp   sD     yy 
 
-1->->~-N-N
 
 
 
 
 	
rK   c                f    d                     d |                     d          D                       S )zbReturn captured text from stdout, if capturing is enabled.

        .. versionadded:: 3.0
         c              3      K   | ]	\  }}|V  
d S rF   rN   rj   s      r3   rl   z'BaseReport.capstdout.<locals>.<genexpr>   7       
 
)G
 
 
 
 
 
rK   zCaptured stdoutrm   ro   s    r3   	capstdoutzBaseReport.capstdoutz   E     ww 
 
-1->->?P-Q-Q
 
 
 
 
 	
rK   c                f    d                     d |                     d          D                       S )zbReturn captured text from stderr, if capturing is enabled.

        .. versionadded:: 3.0
        rr   c              3      K   | ]	\  }}|V  
d S rF   rN   rj   s      r3   rl   z'BaseReport.capstderr.<locals>.<genexpr>   rt   rK   zCaptured stderrrm   ro   s    r3   	capstderrzBaseReport.capstderr   rv   rK   boolc                    | j         dk    S )zWhether the outcome is passed.passedrA   ro   s    r3   r|   zBaseReport.passed        |x''rK   c                    | j         dk    S )zWhether the outcome is failed.failedr}   ro   s    r3   r   zBaseReport.failed   r~   rK   c                    | j         dk    S )zWhether the outcome is skipped.skippedr}   ro   s    r3   r   zBaseReport.skipped   s     |y((rK   c                B    | j                             d          d         S )z3The path portion of the reported node, as a string.z::r   )r?   splitro   s    r3   fspathzBaseReport.fspath   s     {  &&q))rK   c                    dS )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.
        TrN   ro   s    r3   count_towards_summaryz BaseReport.count_towards_summary   s	     trK   c                .    | j         | j         \  }}}|S dS )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:   )rI   r   linenodomains       r3   	head_linezBaseReport.head_line   s$      =$%)]"FFFMtrK   configr   default_markupMapping[str, bool]tuple[str, Mapping[str, bool]]c                T   |j                             | |          \  }}}t          |t                    r||fS t          |t                    rFt          |          dk    r3|\  }}t          |t                    rt          |t                    r||fS t          d|d           d S )N)reportr      zSpytest_report_teststatus() hook (from a plugin) returned an invalid verbose value: z8.
Expected either a string or a tuple of (word, markup).)hookpytest_report_teststatus
isinstancer>   r   lenr   r!   )rI   r   r   	_category_shortverbosewordmarkups           r3   _get_verbose_word_with_markupz(BaseReport._get_verbose_word_with_markup   s     &,[%I%I &J &
 &
"	67 gs## 	+N**gx(( 	$S\\Q->->"LD&$$$ $FG)D)D $V|#,)0, , ,	
 	
 	
 	
 	
rK   dict[str, Any]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_jsonro   s    r3   _to_jsonzBaseReport._to_json   s     t$$$rK   
reportdictdict[str, object]r#   c                0    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.
        rN   )_report_kwargs_from_json)clsr   kwargss      r3   
_from_jsonzBaseReport._from_json   s#     **55s}}V}}rK   N)rB   r
   rC   rD   )rL   r>   rC   r
   rP   r   rC   rD   )rX   r>   rC   rY   rC   r>   )rC   rz   )rC   r7   )r   r   r   r   rC   r   )rC   r   )r   r   rC   r#   )__name__
__module____qualname____annotations__rJ   r   rO   rR   r^   propertyrf   rp   ru   ry   r|   r   r   r   r   r   r   r   classmethodr   rN   rK   r3   r6   r6   8   s?        0000    $###KKK3333! ! ! !  43333   (& & & &
    X 
 
 
 X
 
 
 
 X
 
 
 
 X
 ( ( ( X( ( ( ( X( ) ) ) X) * * * X* 	 	 	 X	    X(
 
 
 
*% % % % 
 
 
 [
 
 
rK   r6   	type_namer>   report_classtype[BaseReport]rC   r   c                B   d}t                      }t          d|           t          d|  |           t          d| |           t          ||           t          d| |           t          d|           t          |                                          )Nz+https://github.com/pytest-dev/pytest/issueszd----------------------------------------------------------------------------------------------------)streamz,INTERNALERROR: Unknown entry type returned: zreport_name: zPlease report this bug at )r   r	   RuntimeErrorra   )r   r   r   urlr   s        r3   _report_unserialization_failurer      s     8CZZF
9V$$$$
E)EEfUUUU
)<))&9999
:f%%%%
---f====
9V$$$$
v((
)
))rK   c                  V    e Zd ZU dZdZded<   	 	 	 	 	 d$d%dZd&dZed'd#            Z	dS )(
TestReportzBasic test report object (also used for setup and teardown calls if
    they fail).

    Reports can contain arbitrary extra attributes.
    Fr>   wasxfailrN   r   Nr?   r:   tuple[str, int | None, str]keywordsMapping[str, Any]rA   r@   r<   r;   r8   $Literal['setup', 'call', 'teardown']r=   Iterable[tuple[str, str]]durationfloatstartstopuser_properties#Iterable[tuple[str, object]] | NonerC   rD   c                   || _         || _        || _        || _        || _        || _        t          |pg           | _        t          |          | _        || _	        |	| _
        |
| _        | j                            |           d S rF   )r?   r:   r   rA   r<   r8   listr   r=   r   r   r   rG   rH   )rI   r?   r:   r   rA   r<   r8   r=   r   r   r   r   extras                r3   rJ   zTestReport.__init__  s    (  6> ,4  ! ;?	  $O$9r:: X  ( "
	U#####rK   c           	     R    d| j         j         d| j        d| j        d| j        d	S )N< z when=	 outcome=>)	__class__r   r?   r8   rA   ro   s    r3   __repr__zTestReport.__repr__J  s8    i4>*iiT[ii$)iiX\XdiiiirK   itemr    callCallInfo[None]c                x   |j         }|dk    sJ |j        }|j        }|j        }d |j        D             }|j        }g }	|j        sd}
d}n t          |t                    sd}
|}nt          |j        t          j
                  rd}
|                                }|
J d            |j        j        rC|                                dd         \  }}|J t          j        |          |d	z   |j        f}nut#          |j                  |j        |j        f}nSd}
|j         d
k    r|                    |          }n0|                    ||j                            dd                    }|j        D ]#\  }}}|	                    d| d| |f           $ | |j        |j        ||
|||	||||j                  S )zCreate and fill a TestReport with standard item and call info.

        :param item: The item.
        :param call: The call info.
        collectc                    i | ]}|d S )   rN   )rk   xs     r3   
<dictcomp>z1TestReport.from_item_and_call.<locals>.<dictcomp>Z  s    000QAq000rK   r|   Nr   r   z=There should always be a traceback entry for skipping a test.r   r   r   tbstyleauto)stylez	Captured r   )r   )r8   r   r   r   r   excinfor   r   valuer"   	Exception_getreprcrash_use_item_location
reportinfoosr   messager>   pathr   repr_failure_repr_failure_pyr   	getoption_report_sectionsappendr?   r:   r   )r   r   r   r8   r   r   r   r   r   r=   rA   r<   rr   rT   rwhenrL   r]   s                     r3   from_item_and_callzTestReport.from_item_and_callM  s    yy    =
y00$-000,|  	>FG  H g}55 ""GM4>:: #))++}}S %}} =3 B!%!2!22A2!6JD$+++!yq!)CHH #AFQXqyAHH"9&&#0099HH#44t{'<'<Y'O'O  5    H $(#8 	B 	BE3OO666u66@AAAAsKM 0
 
 
 	
rK   )rN   r   r   r   N)r?   r>   r:   r   r   r   rA   r@   r<   r;   r8   r   r=   r   r   r   r   r   r   r   r   r   rC   rD   r   )r   r    r   r   rC   r   )
r   r   r   __doc____test__r   rJ   r   r   r   rN   rK   r3   r   r      s           H MMM /1?C!<$ <$ <$ <$ <$|j j j j >
 >
 >
 [>
 >
 >
rK   r   c                  B    e Zd ZdZdZ	 dddZedd            ZddZdS )CollectReportzSCollection report object.

    Reports can contain arbitrary extra attributes.
    r   rN   r?   r>   rA   r@   r<   r;   resultlist[Item | Collector] | Noner=   r   rC   rD   c                    || _         || _        || _        |pg | _        t	          |          | _        | j                            |           d S rF   )r?   rA   r<   r   r   r=   rG   rH   )rI   r?   rA   r<   r   r=   r   s          r3   rJ   zCollectReport.__init__  sU       ! l XU#####rK   r9   c                     | j         d | j         fS rF   )r   ro   s    r3   r:   zCollectReport.location  s     T4;//rK   c                R    d| j         dt          | j                   d| j        dS )Nz<CollectReport z lenresult=r   r   )r?   r   r   rA   ro   s    r3   r   zCollectReport.__repr__  s3    ggg3t{;K;KggVZVbggggrK   N)rN   )r?   r>   rA   r@   r<   r;   r   r   r=   r   rC   rD   )rC   r9   r   )	r   r   r   r   r8   rJ   r   r:   r   rN   rK   r3   r   r     s~         
 D /1$ $ $ $ $B 0 0 0 X0
h h h h h hrK   r   c                      e Zd Zd
dZddZd	S )CollectErrorReprmsgr>   rC   rD   c                    || _         d S rF   )r<   )rI   r   s     r3   rJ   zCollectErrorRepr.__init__  s    rK   rP   r   c                >    |                     | j        d           d S )NT)red)rT   r<   )rI   rP   s     r3   rR   zCollectErrorRepr.toterminal  s     D)))))rK   N)r   r>   rC   rD   r   )r   r   r   rJ   rR   rN   rK   r3   r   r     s<           * * * * * *rK   r   r   CollectReport | TestReportdict[str, Any] | Nonec                    t          | t          t          f          r%|                                 }| j        j        |d<   |S d S )N$report_type)r   r   r   r   r   r   )r   datas     r3   pytest_report_to_serializabler    sD     &:}566   %/8^4rK   r   r   !CollectReport | TestReport | Nonec                    d| v ro| d         dk    rt                               |           S | d         dk    rt                              |           S J d                    | d                               d S )Nr   r   r   Fz(Unknown report_type unserialize data: {})r   r   r   r.   )r   s    r3   pytest_report_from_serializabler    s     <//((....!_44 ++D111	
@GG 
 
 	
 	
 	
 4rK   c                   dddfddddfd}| j                                         }t          | j        d          rQt          | j        d          r$t          | j        d	          r ||           |d<   n"t	          | j                  |d<   n
| j        |d<   |D ]K}t          ||         t          j                  rt          j        ||                   ||<   @|dk    rd||<   L|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).
    entryReprEntry | ReprEntryNativerC   r   c                    t          j        |           }|                                D ],\  }}t          |d          rt          j        |          ||<   -t	          |           j        |d}|S )NrG   )typer   )dataclassesasdictitemsrS   r	  r   )r  r   rL   r   
entry_datas        r3   serialize_repr_entryz-_report_to_json.<locals>.serialize_repr_entry  sr     !%((**,, 	6 	6JCuj)) 6'.u55S	"5kk2DAA
rK   reprtracebackr   c                \    t          j        |           }fd| j        D             |d<   |S )Nc                &    g | ]} |          S rN   rN   )rk   r   r  s     r3   
<listcomp>zE_report_to_json.<locals>.serialize_repr_traceback.<locals>.<listcomp>  s2     !
 !
 !
()  ##!
 !
 !
rK   reprentries)r
  r  r  )r  r   r  s     r3   serialize_repr_tracebackz1_report_to_json.<locals>.serialize_repr_traceback  sJ    #M22!
 !
 !
 !
-:-F!
 !
 !
} rK   	reprcrashReprFileLocation | Noner   c                2    | t          j        |           S d S rF   )r
  r  )r  s    r3   serialize_repr_crashz-_report_to_json.<locals>.serialize_repr_crash  s       %i0004rK   repr6   c                X   | j         J t          t          | j                   } |j                   |j                  |j        d}t          |t                    rDg |d<   |j        D ]6\  }}}|d         	                     |           |          |f           7n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         r3   serialize_exception_longreprz5_report_to_json.<locals>.serialize_exception_longrepr  s    |'''s|44--h.@AA55h6LMM )"
 "

 h 233 	# F7O;C>  7
Kw&&00@@,,Z88#    #F7OrK   rR   r<   r   N)r  r  rC   r   )r  r   rC   r   )r  r  rC   r   )r  r6   rC   r   )	rG   copyrS   r<   r>   r   r   PathLiker   )r   r  r0   r\   r  r  r  s       @@@r3   r   r     sU                    . 	Av-- (6?O44 	1O[:
 :
 	1 98@@AjMM00AjMM*  agr{++ 	i$((AdGGXAdGHrK   r   c                     fdfd}dd} d         rd d         v rd d         v r | d         d                   } | d         d                   } d         d	         rQg } d         d	         D ]0\  }}}|                      ||           ||          |f           1t          |          }	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    r~d }d }d }|d         rt          di |d         }|d         rt          di |d         }|d         rt          |d         d                   }t          |d         ||||d         	          }n2|d
k    rt	          |d                   }nt          |t                     |S )Nr   r	  r   reprfuncargsreprfileloc
reprlocalslinesr   )r'  r$  r&  r%  r   r   rN   )r   r   r   r   r   r   r   )r  r   
entry_typer$  r%  r&  	reprentryr   s          r3   deserialize_repr_entryz8_report_kwargs_from_json.<locals>.deserialize_repr_entry4  s   &!'
$$LKJN# D+CCd>.BCCM" F.EEm1DEEL! E'\(:7(CDD
5>7m)%'7m6 6 6II ,,,'W66II+J
JOOOrK   c                J    fd| d         D             | d<   t          di | S )Nc                &    g | ]} |          S rN   rN   )rk   r   r*  s     r3   r  zP_report_kwargs_from_json.<locals>.deserialize_repr_traceback.<locals>.<listcomp>P  s2     .
 .
 .
*+""1%%.
 .
 .
rK   r  rN   r   )repr_traceback_dictr*  s    r3   deserialize_repr_tracebackz<_report_kwargs_from_json.<locals>.deserialize_repr_tracebackO  sM    .
 .
 .
 .
/B=/Q.
 .
 .
M* 332333rK   repr_crash_dictr   c                "    | t          di | S d S )NrN   r   )r/  s    r3   deserialize_repr_crashz8_report_kwargs_from_json.<locals>.deserialize_repr_crashU  s!    &#66o6664rK   r<   r  r  r  )r  r  r=   )r/  r   )r   r   r   
addsection)r   r.  r1  r  r  r  repr_traceback_datarepr_crash_datar  exception_infosectionr*  s   `          @r3   r   r   -  s       64 4 4 4 4    	: 0:j111z*55522z"?3
 
 +*:j+A++NOO	j!'* 	EEOFF 	 	A#_k 223FGG..??#    FXF FNN /+#  N
 "*-j9 	0 	0G%N%w///!/
:rK   )r   r>   r   r   rC   r   )r   r   rC   r   )r   r   rC   r  )r   r6   rC   r   )r   r   rC   r   )7
__future__r   collections.abcr   r   r   r   r
  ior   r   r	   typingr
   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!   r"   typing_extensionsr#   _pytest.runnerr$   r4   r6   r   r   r   r   r  r  r   r   rN   rK   r3   <module>rB     s   " " " " " " $ $ $ $ $ $ $ $ $ $ $ $ # # # # # # $ $ $ $ $ $           				                                                 1 1 1 1 1 1 , , , , , , , , , , , , ( ( ( ( ( ( . . . . . . 0 0 0 0 0 0 / / / / / / + + + + + + ) ) ) ) ) ) , , , , , , + + + + + + & & & & & & ! ! ! ! ! ! # # # # # #       ! ! ! ! ! ! ! ! ! ! ! !  (&&&&&&''''''	 	 	u u u u u u u up* * * * M
 M
 M
 M
 M
 M
 M
 M
` 0h 0h 0h 0h 0hJ 0h 0h 0hf* * * * *| * * *      F F F FRP P P P P PrK   