
    F-Ph&                    Z   d 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	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% g dZ& e#ee                              Z'ddddCd(Z(dDd,Z) ed-.          dEd2            Z*e	j+         G d3 d4                      Z,dFd7Z-e	j+         G d8 d9                      Z.dFd:Z/dGd?Z0dFd@Z1dHdAZ2dHdBZ3dS )Iz=Generic mechanism for marking and selecting python functions.    )annotationsN)
Collection)Iterable)Set)Optional)TYPE_CHECKING   )
Expression)
ParseError)_HiddenParam)EMPTY_PARAMETERSET_OPTION)get_empty_parameterset_mark)HIDDEN_PARAM)Mark)MARK_GEN)MarkDecorator)MarkGenerator)ParameterSet)Config)ExitCode)hookimpl)
UsageError)NOT_SET)Parser)StashKey)Item)r   r   r   r   r   r   r    marksidvaluesobjectr   0MarkDecorator | Collection[MarkDecorator | Mark]r    str | _HiddenParam | Nonereturnr   c                &    t          j        || |dS )a$  Specify a parameter in `pytest.mark.parametrize`_ calls or
    :ref:`parametrized fixtures <fixture-parametrize-marks>`.

    .. code-block:: python

        @pytest.mark.parametrize(
            "test_input,expected",
            [
                ("3+5", 8),
                pytest.param("6*9", 42, marks=pytest.mark.xfail),
            ],
        )
        def test_eval(test_input, expected):
            assert eval(test_input) == expected

    :param values: Variable args of the values of the parameter set, in order.

    :param marks:
        A single mark or a list of marks to be applied to this parameter set.

        :ref:`pytest.mark.usefixtures <pytest.mark.usefixtures ref>` cannot be added via this parameter.

    :type id: str | Literal[pytest.HIDDEN_PARAM] | None
    :param id:
        The id to attribute to this parameter set.

        .. versionadded:: 8.4
            :ref:`hidden-param` means to hide the parameter set
            from the test name. Can only be used at most 1 time, as
            test names need to be unique.
    r   )r   param)r   r    r!   s      U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/mark/__init__.pyr'   r'   3   s    H vUr::::    parserr   Nonec                0   |                      d          }|                    dddddd           |                    d	dd
ddd           |                    ddd           |                     ddd           |                     t          d           d S )Ngeneralz-kstorekeyword 
EXPRESSIONa  Only run tests which match the given substring expression. An expression is a Python evaluable expression where all names are substring-matched against test names and their parent classes. Example: -k 'test_method or test_other' matches all test functions and classes whose name contains 'test_method' or 'test_other', while -k 'not test_method' matches those that don't contain 'test_method' in their names. -k 'not test_method and not test_other' will eliminate the matches. Additionally keywords are matched to classes and functions containing extra names in their 'extra_keyword_matches' set, as well as functions which have names assigned directly to them. The matching is case-insensitive.)actiondestdefaultmetavarhelpz-mmarkexprMARKEXPRzUOnly run tests matching given mark expression. For example: -m 'mark1 and not mark2'.z	--markers
store_truez4show markers (builtin, plugin and per-project ones).)r2   r6   markersz'Register new markers for test functionslinelistz&Default marker for empty parametersets)getgroup
_addoption	addoptionaddinir   )r*   groups     r(   pytest_addoptionrA   Z   s    OOI&&E	,    ( 
1     
OOC     MM)F
SSS
MM+-UVVVVVr)   T)tryfirstconfigr   int | ExitCode | Nonec                   dd l }| j        j        r|                                  |j                            |           }|                     d          D ]}|                    dd          }|d         }t          |          dk    r|d         nd}|	                    d| dd	           |
                    |           |
                                 |                                  dS d S )
Nr   r:   :r	      r0   z@pytest.mark.T)bold)_pytest.configoptionr:   _do_configurerC   create_terminal_writergetinisplitlenwriteline_ensure_unconfigure)rC   _pytesttwrQ   partsnamerests          r(   pytest_cmdline_mainrX      s    } ^226::MM),, 	 	DJJsA&&E8D"5zzQ588BDHH,T,,,4H888GGDMMMGGIIII""$$$q4r)   c                  B    e Zd ZU dZdZded<   edd            ZddZdS )KeywordMatchera  A matcher for keywords.

    Given a list of names, matches any substring of one of these names. The
    string inclusion check is case-insensitive.

    Will match on the name of colitem, including the names of its parents.
    Only matches names of items which are either a :class:`Class` or a
    :class:`Function`.

    Additionally, matches on names in the 'extra_keyword_matches' set of
    any item, as well as names directly assigned to test functions.
    )_nameszAbstractSet[str]r[   itemr   r%   c                4   t                      }dd l}|                                D ]b}t          ||j                  rt          ||j                  rt          |j        |j                  rH|                    |j                   c|	                    |
                                           t          |dd           }|r|	                    |j                   |	                    d |                                D                         | |          S )Nr   functionc              3  $   K   | ]}|j         V  d S N)rV   ).0marks     r(   	<genexpr>z+KeywordMatcher.from_item.<locals>.<genexpr>   s$      FF$DIFFFFFFr)   )setpytest	listchain
isinstanceSession	DirectoryparentaddrV   updatelistextrakeywordsgetattr__dict__iter_markers)clsr\   mapped_namesre   nodefunction_objs         r(   	from_itemzKeywordMatcher.from_item   s(   uu
 	NN$$ 	( 	(D$// $ 011 jV^7 7  TY'''' 	D2244555 tZ66 	7 5666 	FF$2C2C2E2EFFFFFFs<   r)   subnamestrkwargsstr | int | bool | Noneboolc                   |rt          d                                          t          fd| j        D                       S )Nz3Keyword expressions do not support call parameters.c              3  D   K   | ]}|                                 v V  d S r`   )lower)ra   rV   rv   s     r(   rc   z*KeywordMatcher.__call__.<locals>.<genexpr>   s0      CCt7djjll*CCCCCCr)   )r   r}   anyr[   )selfrv   rx   s    ` r(   __call__zKeywordMatcher.__call__   sM     	TRSSS--//CCCCt{CCCCCCr)   N)r\   r   r%   rZ   )rv   rw   rx   ry   r%   rz   )	__name__
__module____qualname____doc__	__slots____annotations__classmethodru   r   r   r)   r(   rZ   rZ      sk           I! ! ! [!<D D D D D Dr)   rZ   items
list[Item]c                x   |j         j                                        }|sd S t          |d          }g }g }| D ]Z}|                    t
                              |                    s|                    |           E|                    |           [|r$|j        	                    |           || d d <   d S d S )NzWrong expression passed to '-k'r   )
rJ   r/   lstrip_parse_expressionevaluaterZ   ru   appendhookpytest_deselected)r   rC   keywordexprexpr	remaining
deselectedcolitems          r(   deselect_by_keywordr      s    -'..00K [*KLLDIJ & &}}^55g>>?? 	&g&&&&W%%%% %%J%777aaa r)   c                  B    e Zd ZU dZdZded<   edd            ZddZdS )MarkMatcherzuA matcher for markers which are present.

    Tries to match on any marker names, attached to the given colitem.
    )own_mark_name_mappingzdict[str, list[Mark]]r   r:   Iterable[Mark]r%   c                    t          j        t                    }|D ]"}||j                                     |           # | |          S r`   )collectionsdefaultdictlistrV   r   )rq   r:   mark_name_mappingrb   s       r(   from_markerszMarkMatcher.from_markers   sQ    '3D99 	6 	6Ddi(//5555s$%%%r)   rV   rw   rx   ry   rz   c                   | j                             |g           x}sdS |D ]2t          fd|                                D                       r dS 3dS )NFc              3  f   K   | ]+\  }}j                             |t                    |k    V  ,d S r`   )rx   getr   )ra   kvrb   s      r(   rc   z'MarkMatcher.__call__.<locals>.<genexpr>   s<      OO14;??1g..!3OOOOOOr)   T)r   r   allr   )r   rV   rx   matchesrb   s       @r(   r   zMarkMatcher.__call__   su    599$CCC 	5 	 	DOOOOOOOOO ttur)   N)r:   r   r%   r   )rV   rw   rx   ry   r%   rz   )	r   r   r   r   r   r   r   r   r   r   r)   r(   r   r      se          
 +I0000& & & [&     r)   r   c                x   |j         j        }|sd S t          |d          }g }g }| D ]l}|                    t                              |                                                    r|                    |           W|                    |           m|r$|j        	                    |           || d d <   d S d S )NzWrong expression passed to '-m'r   )
rJ   r7   r   r   r   r   rp   r   r   r   )r   rC   	matchexprr   r   r   r\   s          r(   deselect_by_markr     s    &I Y(IJJDIJ $ $==11$2C2C2E2EFFGG 	$T""""d#### %%J%777aaa r)   r   rw   exc_messager
   c                    	 t          j        |           S # t          $ r}t          | d|  d|           d d }~ww xY w)Nz: )r
   compiler   r   )r   r   es      r(   r   r     sb    B!$''' B B BK6646616677TABs    
=8=c                F    t          | |           t          | |           d S r`   )r   r   )r   rC   s     r(   pytest_collection_modifyitemsr     s(    v&&&UF#####r)   c                    t           j        | j        t          <   | t           _        |                     t
                    }|dvrt          t
          d|          d S )N)skipxfailfail_at_collectNr0   z9 must be one of skip, xfail or fail_at_collect but it is )r   _configstashold_mark_config_keyrM   r   r   )rC   empty_parametersets     r(   pytest_configurer     sn    (0(8FL$%H'@AA!OOO( 1 1,1 1
 
 	
 POr)   c                Z    | j                             t          d           t          _        d S r`   )r   r   r   r   r   )rC   s    r(   pytest_unconfigurer   ,  s#    |''(;TBBHr)   )r!   r"   r   r#   r    r$   r%   r   )r*   r   r%   r+   )rC   r   r%   rD   )r   r   rC   r   r%   r+   )r   rw   r   rw   r%   r
   )rC   r   r%   r+   )4r   
__future__r   r   collections.abcr   r   r   AbstractSetdataclassestypingr   r   
expressionr
   r   
structuresr   r   r   r   r   r   r   r   r   rI   r   r   r   r   _pytest.config.argparsingr   r   _pytest.stashr   _pytest.nodesr   __all__r   r'   rA   rX   	dataclassrZ   r   r   r   r   r   r   r   r   r)   r(   <module>r      s   C C " " " " " "     & & & & & & $ $ $ $ $ $ . . . . . .                       " " " " " " " " " " " " $ $ $ $ $ $ 1 1 1 1 1 1 3 3 3 3 3 3 $ $ $ $ $ $                   % % % % % % % % % % % % $ $ $ $ $ $ ! ! ! ! ! ! # # # # # # # # # # # # % % % % % % - - - - - - , , , , , , " " " " " "  #""""""   1hx/022 
 ?A$($; $; $; $; $; $;N'W 'W 'W 'WT 
4   & 5D 5D 5D 5D 5D 5D 5D 5Dp   (        6   $B B B B$ $ $ $


 

 

 

C C C C C Cr)   