
    g/R                    R   d dl mZ d dlZd dl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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)dAdZ*	 	 	 	 	 	 dBd Z+ G d! d"e      Z,e
 ejZ                  d#$       G d% d&                    Z. ed'eed(e/f   e0f   )      Z1ejZ                   G d* d             Z2d#d+	 	 	 	 	 dCd,Z3	 	 	 	 dDd-Z4dd.dEd/Z5erB G d0 d1e2      Z6 G d2 d3e2      Z7 G d4 d5e2      Z8 G d6 d7e2      Z9 G d8 d9e2      Z: G d: d;e2      Z;e
 G d< d=             Z< e<d#>      Z=e
 G d? d@ee>ef                Z?y)F    )annotationsN)Any)Callable)
Collection)final)Iterable)Iterator)Mapping)MutableMapping)
NamedTuple)overload)Sequence)TYPE_CHECKING)TypeVar)Union   )getfslineno)ascii_escaped)NOTSET)
NotSetType)Config)check_ispytest)MARKED_FIXTURE)fail)
_ScopeName)PytestUnknownMarkWarning)Nodeempty_parameter_set_markc                <    t        |       xr t        | dd      dk7  S )N__name__z<lambda>)callablegetattr)funcs    L/var/www/openai/venv/lib/python3.12/site-packages/_pytest/mark/structures.py
istestfuncr%   *   s    D>QgdJ
CzQQ    MarkDecoratorc                t   ddl m} t        |      \  }}d||j                  ||fz  }| j	                  t
              }|dv rt        j                  |      }|S |dk(  rt        j                  |d      }|S |d	k(  r3|j                  }	t        |      \  }
}|j                  d
|	|dz   fz        t        |      )Nr   )	Collectorz0got empty parameter set %r, function %s at %s:%d) NskipreasonxfailF)r-   runfail_at_collectz&Empty parameter set in '%s' at line %d   )nodesr)   r   r    getiniEMPTY_PARAMETERSET_OPTIONMARK_GENr+   r.   CollectErrorLookupError)configargnamesr#   r)   fslinenor-   requested_markmarkf_name_s              r$   get_empty_parameterset_markr@   .   s     "T"JB?
	C F ]]#<=N++}}F}+ K 
7	"~~V~7 K 
,	,%	6$$4
7KK
 	
 .))r&   c                      e Zd ZU ded<   ded<   ded<   eddd		 	 	 	 	 	 	 dd
       Ze	 d	 	 	 	 	 dd       Ze	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 dd       Z	e	 	 	 	 	 	 	 	 	 	 dd       Z
y)ParameterSetzSequence[object | NotSetType]valuesz Collection[MarkDecorator | Mark]marks
str | Noneid NrD   rF   c                   t        |t              r|f}n&t        |t        j                  j                        sJ |5t        |t
              st        dt        |       d|      t        |      } | |||      S )Nz Expected id to be a string, got z: )	
isinstancer'   collectionsabcr   str	TypeErrortyper   )clsrD   rF   rC   s       r$   paramzParameterSet.paramP   st     e]+HEe[__%?%?@@@>b#&"B48*Brf UVVr"B65"%%r&   c                Z    t        ||       r|S |r| j                  |      S  | |g d      S )aj  Extract from an object or objects.

        :param parameterset:
            A legacy style parameterset that may or may not be a tuple,
            and may or may not be wrapped into a mess of mark objects.

        :param force_tuple:
            Enforce tuple wrapping so single argument tuple values
            don't get decomposed and break tests.
        NrH   )rJ   rQ   )rP   parametersetforce_tuples      r$   extract_fromzParameterSet.extract_fromb   s7      lC(99\** |2$77r&   c                    t        | t              rO| j                  d      D cg c]#  }|j                         s|j                         % } }t	        |       dk(  }| |fS d}| |fS c c}w )N,r1   F)rJ   rM   splitstriplen)r9   	argvaluesargskwargsxrT   s         r$   _parse_parametrize_argsz$ParameterSet._parse_parametrize_args~   sn     h$+3>>#+>L+>a!'')	+>HLh-1,K $$  K$$	 Ms
   A&A&c                V    | D cg c]  }t         j                  ||       c}S c c}w )N)rT   )rB   rU   )r[   rT   r^   s      r$   _parse_parametrize_parametersz*ParameterSet._parse_parametrize_parameters   s7     LU
KTaL%%a[%A9
 	
 
s   &c                   | j                  ||      \  }}| j                  ||      }~|rv|D ]m  }t        |j                        t        |      k7  s%d}	t	        |	j                  ||j                  |t        |      t        |j                              d       o ||fS t        |||      }
|j                  t        t        ft        |      z  |
gd              ||fS )Nz{nodeid}: in "parametrize" the number of names ({names_len}):
  {names}
must be equal to the number of values ({values_len}):
  {values})nodeidrC   names	names_len
values_lenFpytrace)rC   rD   rF   )
r_   ra   rZ   rC   r   formatr@   appendrB   r   )rP   r9   r[   r#   r8   rc   rT   
parametersrQ   msgr=   s              r$   _for_parametrizezParameterSet._for_parametrize   s     !$ ; ;Hi P+66y+N
#u||$H5%  

#)#(<<"*&)(m'*5<<'8 #  !&	 $2 ##	 /vxFDVIH$=dVPTU ##r&   )rC   objectrD   z0MarkDecorator | Collection[MarkDecorator | Mark]rF   rE   returnrB   F)rS   z(ParameterSet | Sequence[object] | objectrT   boolro   rB   )r9   str | Sequence[str]r[   2Iterable[ParameterSet | Sequence[object] | object]ro   ztuple[Sequence[str], bool])r[   rs   rT   rq   ro   zlist[ParameterSet])
r9   rr   r[   rs   r8   r   rc   rM   ro   z(tuple[Sequence[str], list[ParameterSet]])r    
__module____qualname____annotations__classmethodrQ   rU   staticmethodr_   ra   rm   rG   r&   r$   rB   rB   K   s,   ))++N CE	&& @& 	&
 
& &"  "8>8 8 
	8 86 %%%E%
 
$% % 
E

 

 
 '$%'$ F'$
 '$ '$ 
2'$ '$r&   rB   T)frozenc                      e Zd ZU dZded<   ded<   ded<    ej                  dd	
      Zded<    ej                  dd	
      Zded<   	 	 dd	d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	ddZ
ddZy)MarkzA pytest mark.rM   nametuple[Any, ...]r\   Mapping[str, Any]r]   NF)defaultreprMark | None_param_ids_fromSequence[str] | None_param_ids_generated	_ispytestc                   t        |       t        j                  | d|       t        j                  | d|       t        j                  | d|       t        j                  | d|       t        j                  | d|       y):meta private:r|   r\   r]   r   r   N)r   rn   __setattr__)selfr|   r\   r]   param_ids_fromparam_ids_generatedr   s          r$   __init__zMark.__init__   si     	y!4.4.4624!2NC4!79LMr&   c                R    d| j                   v xs t        | j                        dk\  S )Nids   )r]   rZ   r\   r   s    r$   _has_param_idszMark._has_param_ids   s#    #:s499~'::r&   c           	     B   | j                   |j                   k(  sJ d}| j                   dk(  r%|j                         r|}n| j                         r| }t        | j                   | j                  |j                  z   t	        | j
                  fi |j
                  |d      S )zReturn a new Mark which is a combination of this
        Mark and another Mark.

        Combines by appending args and merging kwargs.

        :param Mark other: The mark to combine with.
        :rtype: Mark
        NparametrizeT)r   r   )r|   r   r{   r\   dictr]   )r   otherr   s      r$   combined_withzMark.combined_with   s     yyEJJ&&& '+99%##%!&$$&!%IIII

"--)
 	
r&   )NN)r|   rM   r\   r}   r]   r~   r   r   r   r   r   rq   ro   Nonero   rq   )r   r{   ro   r{   )r    rt   ru   __doc__rv   dataclassesfieldr   r   r   r   r   rG   r&   r$   r{   r{      s      I
 $5;#4#4T#NO[N1B1B1B52.  '+48N  NN N "	N
 $N 2N N 
N&;
r&   r{   Markable.)boundc                      e Zd ZU dZded<   ddddZedd       Zedd       Zedd	       Z	edd
       Z
ddZedd       Zedd       ZddZy)r'   aW  A decorator for applying a mark on test functions and classes.

    ``MarkDecorators`` are created with ``pytest.mark``::

        mark1 = pytest.mark.NAME  # Simple MarkDecorator
        mark2 = pytest.mark.NAME(name1=value)  # Parametrized MarkDecorator

    and can then be applied as decorators to test functions::

        @mark2
        def test_function():
            pass

    When a ``MarkDecorator`` is called, it does the following:

    1. If called with a single class as its only positional argument and no
       additional keyword arguments, it attaches the mark to the class so it
       gets applied automatically to all test cases found in that class.

    2. If called with a single function as its only positional argument and
       no additional keyword arguments, it attaches the mark to the function,
       containing all the arguments already stored internally in the
       ``MarkDecorator``.

    3. When called in any other case, it returns a new ``MarkDecorator``
       instance with the original ``MarkDecorator``'s content updated with
       the arguments passed to this call.

    Note: The rules above prevent a ``MarkDecorator`` from storing only a
    single function or class reference as its positional argument with no
    additional keyword or positional arguments. You can work around this by
    using `with_args()`.
    r{   r=   Fr   c               (    t        |       || _        y)r   N)r   r=   )r   r=   r   s      r$   r   zMarkDecorator.__init__1  s    y!	r&   c                .    | j                   j                  S )zAlias for mark.name.)r=   r|   r   s    r$   r|   zMarkDecorator.name6       yy~~r&   c                .    | j                   j                  S )zAlias for mark.args.)r=   r\   r   s    r$   r\   zMarkDecorator.args;  r   r&   c                .    | j                   j                  S )zAlias for mark.kwargs.)r=   r]   r   s    r$   r]   zMarkDecorator.kwargs@  s     yyr&   c                    | j                   S )r   )r|   r   s    r$   marknamezMarkDecorator.marknameE  s     yyr&   c                    t        | j                  ||d      }t        | j                  j	                  |      d      S )zReturn a MarkDecorator with extra arguments added.

        Unlike calling the MarkDecorator, with_args() can be used even
        if the sole argument is a callable/class.
        Tr   )r{   r|   r'   r=   r   )r   r\   r]   r=   s       r$   	with_argszMarkDecorator.with_argsJ  s4     DIItVt<TYY44T:dKKr&   c                     y NrG   r   args     r$   __call__zMarkDecorator.__call__V      r&   c                     y r   rG   )r   r\   r]   s      r$   r   zMarkDecorator.__call__Z  r   r&   c                    |rQ|sO|d   }t        j                  |      }t        |      dk(  r't        |      s|rt	        || j
                  d       |S  | j                  |i |S )zCall the MarkDecorator.r   r1      
stacklevel)inspectisclassrZ   r%   
store_markr=   r   )r   r\   r]   r#   is_classs        r$   r   zMarkDecorator.__call__^  s]    7Dt,H4yA~:d#3x4q9t~~t.v..r&   N)r=   r{   r   rq   ro   r   ro   rM   )ro   r}   )ro   r~   )r\   rn   r]   rn   ro   r'   r   r   ro   r   )r\   rn   r]   rn   )r    rt   ru   r   rv   r   propertyr|   r\   r]   r   r   r   r   rG   r&   r$   r'   r'     s     D J8= 
          L    /r&   consider_mroc                  t        | t              r|s| j                  j                  dg       g}n<t	        | j
                        D cg c]  }|j                  j                  dg         }}g }|D ]5  }t        |t              r|j                  |       %|j                  |       7 n#t        | dg       }t        |t              r|}n|g}t        t        |            S c c}w )a  Obtain the unpacked marks that are stored on an object.

    If obj is a class and consider_mro is true, return marks applied to
    this class and all of its super-classes in MRO order. If consider_mro
    is false, only return marks applied directly to this class.
    
pytestmark)rJ   rO   __dict__getreversed__mro__listextendrj   r"   normalize_mark_list)objr   
mark_listsr^   	mark_listitemmark_attributes          r$   get_unpacked_marksr   i  s     #t,,**<<=J ;C3;;:O:OQ

|R0:O   	D$%  &  &	  !lB7nd+&I'(I#I.//s   #C!c              #  z   K   | D ]2  }t        |d|      }t        |t              st        d|d      | 4 yw)z
    Normalize an iterable of Mark or MarkDecorator objects into a list of marks
    by retrieving the `mark` attribute on MarkDecorator instances.

    :param mark_list: marks to normalize
    :returns: A new list of the extracted Mark objects
    r=   zgot z instead of MarkN)r"   rJ   r{   rN   )r   r=   mark_objs      r$   r   r     sD      4.(D)d8,.>?@@	 s   9;r   c                   t        |t              sJ |       ddlm}  ||       t	        j
                  t        |       g t        | d      || _        y)zjStore a Mark on an object.

    This is used to implement the Mark declarations/decorators correctly.
    r   )getfixturemarkerNr   Fr   )	rJ   r{   fixturesr   warningswarnr   r   r   )r   r=   r   r   s       r$   r   r     sQ    
 dD!'4'!+(n< J)#EBIDICNr&   c                  2    e Zd Zedd       Zeddd       Zy)_SkipMarkDecoratorc                     y r   rG   r   s     r$   r   z_SkipMarkDecorator.__call__      7:r&   c                     y r   rG   )r   r-   s     r$   r   z_SkipMarkDecorator.__call__  s    @Cr&   Nr   .)r-   rM   ro   r'   r    rt   ru   r   r   rG   r&   r$   r   r     s    	: 
:	C 
Cr&   r   c                  ,    e Zd Z	 ddd	 	 	 	 	 	 	 ddZy)_SkipifMarkDecorator.r,   c                    y r   rG   )r   	conditionr-   
conditionss       r$   r   z_SkipifMarkDecorator.__call__  s    
  r&   Nr   )r   
str | boolr   r   r-   rM   ro   r'   r    rt   ru   r   rG   r&   r$   r   r     s<     %(	  		 !	  $	  		 
 	 r&   r   c                  Z    e Zd Zedd       Ze	 dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Zy)	_XfailMarkDecoratorc                     y r   rG   r   s     r$   r   z_XfailMarkDecorator.__call__  r   r&   .)r-   r/   raisesstrictc                    y r   rG   )r   r   r-   r/   r   r   r   s          r$   r   z_XfailMarkDecorator.__call__  s      r&   Nr   rp   )r   r   r   r   r-   rM   r/   rq   r   z<None | type[BaseException] | tuple[type[BaseException], ...]r   rq   ro   r'   r   rG   r&   r$   r   r     s    	: 
:	 %*	  SV	 !	  $	  		 
 	  Q	  	  	  
	 r&   r   c                  4    e Zd Zdddd	 	 	 	 	 	 	 	 	 	 	 ddZy)_ParametrizeMarkDecorator.)indirectr   scopec                    y r   rG   )r   r9   r[   r   r   r   s         r$   r   z"_ParametrizeMarkDecorator.__call__  s      r&   N)r9   rr   r[   rs   r   zbool | Sequence[str]r   zQIterable[None | str | float | int | bool] | Callable[[Any], object | None] | Noner   z_ScopeName | Nonero   r'   r   rG   r&   r$   r   r     sO     .1 '*
	 )
	  J
	 
 +
	 
	  %
	  
	 r&   r   c                      e Zd ZddZy)_UsefixturesMarkDecoratorc                     y r   rG   )r   r   s     r$   r   z"_UsefixturesMarkDecorator.__call__      r&   N)r   rM   ro   r'   r   rG   r&   r$   r   r         	r&   r   c                      e Zd ZddZy)_FilterwarningsMarkDecoratorc                     y r   rG   )r   filterss     r$   r   z%_FilterwarningsMarkDecorator.__call__  r   r&   N)r   rM   ro   r'   r   rG   r&   r$   r   r     r   r&   r   c                  h    e Zd ZU dZerded<   ded<   ded<   ded	<   d
ed<   ded<   ddddZddZy)MarkGeneratora  Factory for :class:`MarkDecorator` objects - exposed as
    a ``pytest.mark`` singleton instance.

    Example::

         import pytest


         @pytest.mark.slowtest
         def test_function():
             pass

    applies a 'slowtest' :class:`Mark` on ``test_function``.
    r   r+   r   skipifr   r.   r   r   r   usefixturesr   filterwarningsFr   c               F    t        |       d | _        t               | _        y r   )r   _configset_markers)r   r   s     r$   r   zMarkGenerator.__init__  s    y!&*"%%r&   c                   |d   dk(  rt        d      | j                  || j                  vro| j                  j                  d      D ]Q  }|j	                  d      d   j	                  d      d   j                         }| j                  j                  |       S || j                  vr| j                  j                  j                  s | j                  j                  j                  rt        |dd	       |d
v rd}t        d| d       t        j                  d| dt        d       t        t        |di d      d      S )z:Generate a new :class:`MarkDecorator` with the given name.r   r?   z*Marker name must NOT start with underscoremarkers:(z, not found in `markers` configuration optionFrg   )parameterizeparametriseparameteriseTz	Unknown 'z#' mark, did you mean 'parametrize'?zUnknown pytest.mark.z - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.htmlr   rG   r   )AttributeErrorr   r   r3   rX   rY   addoptionstrict_markersr   r   r   r   r   r'   r{   )r   r|   linemarker__tracebackhide__s        r$   __getattr__zMarkGenerator.__getattr__  s6   7c> !MNN<<# 4==( LL//	:D "ZZ_Q/55c:1=CCEFMM%%f- ; 4==(<<&&559L9L9S9S("NO % JJ(,%9TF*MNO*4& 1I I - T$B$?4PPr&   N)r   rq   ro   r   )r|   rM   ro   r'   )r    rt   ru   r   r   rv   r   r  rG   r&   r$   r   r     s>        $$""....44,1 (
'Qr&   r   r   c                  f    e Zd ZdZddZddZddZddZ	 d	 	 	 	 	 ddZddZ	ddZ
dd	Zdd
Zy)NodeKeywords)nodeparentr   c                Z    || _         |j                  | _        |j                  di| _        y )NT)r  r  r|   r   )r   r  s     r$   r   zNodeKeywords.__init__4  s$    	kkD)r&   c                    	 | j                   |   S # t        $ r) | j                   | j                  j                  |   cY S w xY wr   )r   KeyErrorr  keywordsr   keys     r$   __getitem__zNodeKeywords.__getitem__9  sG    	-==%% 	-{{";;'',,	-s    /AAc                "    || j                   |<   y r   )r   )r   r  values      r$   __setitem__zNodeKeywords.__setitem__A  s    "cr&   c                r    || j                   v xs( | j                  d uxr || j                  j                  v S r   r   r  r  r  s     r$   __contains__zNodeKeywords.__contains__G  s;    4==  ,{{$& ,t{{+++	
r&   c                p    | j                   j                  |       | j                   j                  |       y r   )r   update)r   r   kwdss      r$   r  zNodeKeywords.updateN  s(    
 	U#T"r&   c                    t        d      )Nz"cannot delete key in keywords dict)
ValueErrorr  s     r$   __delitem__zNodeKeywords.__delitem__V  s    =>>r&   c              #     K   | j                   E d {    | j                  /| j                  j                  D ]  }|| j                   vs|  y y 7 @wr   r  )r   keywords     r$   __iter__zNodeKeywords.__iter__Y  sL     ==  ;;";;//$--/!M 0 # 	!s   AA7A	Ac                &    t        d | D              S )Nc              3      K   | ]  }d   yw)r1   NrG   ).0r%  s     r$   	<genexpr>z'NodeKeywords.__len__.<locals>.<genexpr>d  s     )D1Ds   )sumr   s    r$   __len__zNodeKeywords.__len__b  s    )D)))r&   c                "    d| j                    dS )Nz<NodeKeywords for node >)r  r   s    r$   __repr__zNodeKeywords.__repr__f  s    (155r&   N)r  r   ro   r   )r  rM   ro   r   )r  rM   r  r   ro   r   )r  rn   ro   rq   )rG   )r   z-Mapping[str, Any] | Iterable[tuple[str, Any]]r   r   ro   r   )r  rM   ro   r   )ro   zIterator[str])ro   intr   )r    rt   ru   	__slots__r   r  r  r  r  r#  r&  r,  r/  rG   r&   r$   r  r  0  sW    .I*
-#
 @B#<# # 
	#?"*6r&   r  r   )r8   r   r9   zSequence[str]ro   r'   )r   zobject | typer   rq   ro   z
list[Mark])r   zIterable[Mark | MarkDecorator]ro   zIterable[Mark])r=   r{   r   r0  ro   r   )@
__future__r   collections.abcrK   r   r   typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   _coder   compatr   r   r   _pytest.configr   _pytest.deprecatedr   r   _pytest.outcomesr   _pytest.scoper   _pytest.warning_typesr   r2   r   r4   r%   r@   rB   	dataclassr{   rn   rO   r   r'   r   r   r   r   r   r   r   r   r   r   r5   rM   r  rG   r&   r$   <module>r=     s   "           !          "   ! - - ! $ :  7 R+:r$: r$j d#@
 @
 $ @
L :U8CK+@$+F%GH Z/ Z/ Z/@ 0	0 0 	0B-" 67 J& D] D }   m   M  M } 
 EQ EQ EQP 4( 66>#s(+ 66 66r&   