
    עi&                    ,   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! erddl"m#Z# g dZ$ e!edz            Z%ddd	 	 	 	 	 	 	 d-dZ&d.dZ' ed !      d/d"       Z(e	jR                   G d# d$             Z*d0d%Z+e	jR                   G d& d'             Z,d0d(Z-d1d)Z.d0d*Z/d2d+Z0d2d,Z1y)3z=Generic mechanism for marking and selecting python functions.    )annotationsN)
Collection)Iterable)Set)TYPE_CHECKING   )
Expression)_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idc                .    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   valuess      V/sites/domain-asset-master/.venv/lib/python3.12/site-packages/_pytest/mark/__init__.pyr    r    1   s    H vUr::    c                    | j                  d      }|j                  dddddd       |j                  d	dd
ddd       |j                  ddd       | j                  ddd       | j                  t        d       y )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).)r*   r.   markersz'Register new markers for test functionslinelistz&Default marker for empty parametersets)getgroup
_addoption	addoptionaddinir   )parsergroups     r"   pytest_addoptionr:   X   s    OOI&E	,  ( 
1   
OOC   MM)F
S
MM+-UVr#   T)tryfirstc                   dd l }| j                  j                  r| j                          |j                  j                  |       }| j                  d      D ]f  }|j                  dd      }|d   }t        |      dk(  r|d   nd}|j                  d| dd	       |j                  |       |j                          h | j                          yy )
Nr   r2   :r      r(   z@pytest.mark.T)bold)_pytest.configoptionr2   _do_configureconfigcreate_terminal_writergetinisplitlenwriteline_ensure_unconfigure)rC   _pytesttwrI   partsnamerests          r"   pytest_cmdline_mainrP      s    }}^^226:MM), 	DJJsA&E8D"5zQ58BDHH}TF!,4H8GGDMGGI	 	""$r#   c                  :    e Zd ZU dZdZded<   edd       Zd	dZy)
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]rS   c                   t               }dd l}|j                         D ]k  }t        ||j                        rt        ||j
                        r!t        |j                  |j                        rQ|j                  |j                         m |j                  |j                                t        |dd       }|r|j                  |j                         |j                  d |j                         D                | |      S )Nr   functionc              3  4   K   | ]  }|j                     y wN)rN   ).0marks     r"   	<genexpr>z+KeywordMatcher.from_item.<locals>.<genexpr>   s     F$DIIFs   )setpytest	listchain
isinstanceSession	DirectoryparentaddrN   updatelistextrakeywordsgetattr__dict__iter_markers)clsitemmapped_namesr\   nodefunction_objs         r"   	from_itemzKeywordMatcher.from_item   s    u
 	NN$ 	(D$/$ 0 01jV^^7 TYY'	( 	D2245 tZ6 5 56 	F$2C2C2EFF<  r#   c               z    |rt        d      j                         t        fd| j                  D              S )Nz3Keyword expressions do not support call parameters.c              3  B   K   | ]  }|j                         v   y wrW   )lower)rX   rN   subnames     r"   rZ   z*KeywordMatcher.__call__.<locals>.<genexpr>   s     Ct7djjl*Cs   )r   rp   anyrS   )selfrq   kwargss    ` r"   __call__zKeywordMatcher.__call__   s2    RSS--/Ct{{CCCr#   N)ri   r   returnrR   )rq   strrt   str | int | bool | Nonerv   bool)	__name__
__module____qualname____doc__	__slots____annotations__classmethodrm   ru   r   r#   r"   rR   rR      s,     I! !<Dr#   rR   c                V   |j                   j                  j                         }|sy t        |d      }g }g }| D ]I  }|j	                  t
        j                  |            s|j                  |       9|j                  |       K |r"|j                  j                  |       || d d  y y )NzWrong expression passed to '-k'items)
rA   r'   lstrip_parse_expressionevaluaterR   rm   appendhookpytest_deselected)r   rC   keywordexprexpr	remaining
deselectedcolitems          r"   deselect_by_keywordr      s    --''..0K[*KLDIJ &}}^55g>?g&W%	& %%J%7a r#   c                  :    e Zd ZU dZdZded<   edd       Zd	dZy)
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   c                    t        j                  t              }|D ]   }||j                     j	                  |       "  | |      S rW   )collectionsdefaultdictlistrN   r   )rh   r2   mark_name_mappingrY   s       r"   from_markerszMarkMatcher.from_markers   sE    '33D9 	6Ddii(//5	6$%%r#   c                   | j                   j                  |g       x}sy|D ]&  t        fd|j                         D              s& y y)NFc              3  j   K   | ]*  \  }}j                   j                  |t              |k(   , y wrW   )rt   getr   )rX   kvrY   s      r"   rZ   z'MarkMatcher.__call__.<locals>.<genexpr>   s)     O14;;??1g.!3Os   03T)r   r   allr   )rs   rN   rt   matchesrY   s       @r"   ru   zMarkMatcher.__call__   sO    5599$CCC 	DOOO	 r#   N)r2   zIterable[Mark]rv   r   )rN   rw   rt   rx   rv   ry   )	rz   r{   r|   r}   r~   r   r   r   ru   r   r#   r"   r   r      s+    
 +I00& &r#   r   c                V   |j                   j                  }|sy t        |d      }g }g }| D ]W  }|j                  t        j                  |j                                     r|j                  |       G|j                  |       Y |r"|j                  j                  |       || d d  y y )NzWrong expression passed to '-m'r   )
rA   r/   r   r   r   r   rg   r   r   r   )r   rC   	matchexprr   r   r   ri   s          r"   deselect_by_markr      s    &&IY(IJDIJ $==11$2C2C2EFGT"d#	$
 %%J%7a r#   c           
         	 t        j                  |       S # t        $ r:}t        | d|j                   d|j
                   d|j                         d d }~ww xY w)Nz: z: at column )r	   compileSyntaxErrorr   textoffsetmsg)r   exc_messagees      r"   r   r     s^    !!$'' m2affX\!((2aeeWE
	s    	A5AAc                4    t        | |       t        | |       y rW   )r   r   )r   rC   s     r"   pytest_collection_modifyitemsr     s    v&UF#r#   c                    t         j                  | j                  t        <   | t         _        | j	                  t
              }|dvrt        t
        d|      y )N)skipxfailfail_at_collectNr(   z9 must be one of skip, xfail or fail_at_collect but it is )r   _configstashold_mark_config_keyrE   r   r   )rC   empty_parametersets     r"   pytest_configurer     sa    (0(8(8FLL$%H'@A!OO(+ ,,/1
 	
 Pr#   c                V    | j                   j                  t        d       t        _        y rW   )r   r   r   r   r   )rC   s    r"   pytest_unconfigurer   ,  s    ||''(;TBHr#   )r!   objectr   z0MarkDecorator | Collection[MarkDecorator | Mark]r   zstr | _HiddenParam | Nonerv   r   )r8   r   rv   None)rC   r   rv   zint | ExitCode | None)r   z
list[Item]rC   r   rv   r   )r   rw   r   rw   rv   r	   )rC   r   rv   r   )2r}   
__future__r   r   collections.abcr   r   r   AbstractSetdataclassestypingr   
expressionr	   
structuresr
   r   r   r   r   r   r   r   r   r@   r   r   r   r   _pytest.config.argparsingr   r   _pytest.stashr   _pytest.nodesr   __all__r   r    r:   rP   	dataclassrR   r   r   r   r   r   r   r   r   r#   r"   <module>r      s)   C "  & $ .    " $ 1 3 $    % % $ ! # # % - , " " .hv}-/ 
 ?A$($;$;;$; 	"$; 	$;N'WT 
4 & 5D 5D 5Dp(   6$$


Cr#   