§
    øÛg’  ã                   ó´   — d Z ddlZddlZddlZddlmZ ddlmZ d„ Zd„ Zd„ Z	 G d„ d	e
¦  «        Z G d
„ d¦  «        Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zej        ZdS )zD
support for presenting detailed information in failing assertions.
é    N)Úutil)Úrewritec           	      óh   — |                       d¦  «        }|                     ddddddd¬	¦  «         d S )
NÚdebugconfigz--assertÚstoreÚ
assertmode)r   Úplainr   ÚMODEa4  Control assertion debugging tools.  'plain'
                            performs no assertion debugging.  'rewrite'
                            (the default) rewrites assert statements in
                            test modules on import to provide assert
                            expression information.)ÚactionÚdestÚchoicesÚdefaultÚmetavarÚhelp)ÚgetgroupÚ	addoption)ÚparserÚgroups     úP/granary/edev/quantum/lib/python3.11/site-packages/_pytest/assertion/__init__.pyÚpytest_addoptionr      sN   € Ø�OŠO˜MÑ*Ô*€EØ	‡O‚O�JØ"Ø%Ø1Ø%Ø"ð7ð ñ 
8ô 
8ð 
8ð 
8ð 
8ó    c                  ó   — dt           iS )NÚregister_assert_rewrite)r   © r   r   Úpytest_namespacer      s   € Ø%Õ'>Ð?Ð?r   c                  ó&  — | D ]H}t          |t          ¦  «        s1d}t          |                     t	          | ¦  «        ¦  «        ¦  «        ‚ŒIt
          j        D ] }t          |t          j        ¦  «        r|} nŒ!t          ¦   «         } |j
        | Ž  dS )a™  Register a module name to be rewritten on import.

    This function will make sure that this module or all modules inside
    the package will get their assert statements rewritten.
    Thus you should make sure to call this before the module is
    actually imported, usually in your __init__.py if you are a plugin
    using a package.

    :raise TypeError: if the given module names are not strings.
    z/expected module names as *args, got {0} insteadN)Ú
isinstanceÚstrÚ	TypeErrorÚformatÚreprÚsysÚ	meta_pathr   ÚAssertionRewritingHookÚDummyRewriteHookÚmark_rewrite)ÚnamesÚnameÚmsgÚhookÚ
importhooks        r   r   r      s©   € ð ð 5ð 5ˆÝ˜$¥Ñ$Ô$ð 	5ØCˆCÝ˜CŸJšJ¥t¨E¡{¤{Ñ3Ô3Ñ4Ô4Ð4ð	5õ ”ð (ð (ˆÝ�d�GÔ:Ñ;Ô;ð 	ØˆJØˆEð	õ &Ñ'Ô'ˆ
Ø€JÔ˜UÐ#Ð#Ð#Ð#r   c                   ó   — e Zd ZdZd„ ZdS )r%   z3A no-op import hook for when rewriting is disabled.c                 ó   — d S ©Nr   )Úselfr'   s     r   r&   zDummyRewriteHook.mark_rewrite:   s   € Øˆr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r&   r   r   r   r%   r%   7   s)   € € € € € Ø=Ð=ðð ð ð ð r   r%   c                   ó   — e Zd ZdZd„ ZdS )ÚAssertionStatezState for the assertion plugin.c                 ój   — || _         |j        j                             d¦  «        | _        d | _        d S )NÚ	assertion)ÚmodeÚtraceÚrootÚgetr*   )r/   Úconfigr8   s      r   Ú__init__zAssertionState.__init__A   s.   € ØˆŒ	Ø”\Ô&×*Ò*¨;Ñ7Ô7ˆŒ
ØˆŒ	ˆ	ˆ	r   N)r0   r1   r2   r3   r=   r   r   r   r5   r5   >   s)   € € € € € Ø)Ð)ðð ð ð ð r   r5   c                 ó¦  ‡ — t           j                             d¦  «        st           j        dd…         dk    rt	          d¦  «        ‚t          ‰ d¦  «        ‰ _        t          j        ‰ ¦  «        x‰ j        _	        }t           j
                             d|¦  «         ‰ j                             d¦  «         ˆ fd	„}‰                      |¦  «         |S )
z?Try to install the rewrite hook, raise SystemError if it fails.ÚjavaNé   )é   é   r   zrewrite not supportedr   r   zinstalled rewrite import hookc                  ó†   •— ‰j         j        } | �/| t          j        v r#t          j                             | ¦  «         d S d S d S r.   )Ú_assertstater*   r"   r#   Úremove)r*   r<   s    €r   Úundoz install_importhook.<locals>.undoS   sJ   ø€ ØÔ"Ô'ˆØÐ ­¬Ð 5Ð 5ÝŒM× Ò  Ñ&Ô&Ð&Ð&Ð&ð ÐÐ 5Ð 5r   )r"   ÚplatformÚ
startswithÚversion_infoÚSystemErrorr5   rD   r   r$   r*   r#   Úinsertr9   Úadd_cleanup)r<   r*   rF   s   `  r   Úinstall_importhookrM   G   sÔ   ø€ õ 	Œ×Ò Ñ'Ô'ð 3ÝÔ˜R˜a˜RÔ  IÒ-Ð-ÝÐ1Ñ2Ô2Ð2å(¨°Ñ;Ô;€FÔÝ&-Ô&DÀVÑ&LÔ&LÐL€FÔÔ˜tÝ„M×Ò˜˜DÑ!Ô!Ð!Ø
Ô×ÒÐ=Ñ>Ô>Ð>ð'ð 'ð 'ð 'ð 'ð ×Ò�tÑÔÐØ€Kr   c                 ó€   — t          | j        dd ¦  «        }|r#|j        �|j                             | ¦  «         d S d S d S ©NrD   ©Úgetattrr<   r*   Úset_session©ÚsessionÚassertstates     r   Úpytest_collectionrV   [   sU   € õ ˜'œ.¨.¸$Ñ?Ô?€KØð 2ØÔÐ'ØÔ×(Ò(¨Ñ1Ô1Ð1Ð1Ð1ð2ð 2Ø'Ð'r   c                  ó<   — ddg} t          d„ | D ¦   «         ¦  «        S )z0Check if we're currently running on a CI system.ÚCIÚBUILD_NUMBERc              3   ó2   K  — | ]}|t           j        v V — Œd S r.   )ÚosÚenviron)Ú.0Úvars     r   ú	<genexpr>z!_running_on_ci.<locals>.<genexpr>h   s)   è è € Ð5Ð5 Sˆs•b”jÐ Ð5Ð5Ð5Ð5Ð5Ð5r   )Úany)Úenv_varss    r   Ú_running_on_cirb   e   s)   € à�nÐ%€HÝÐ5Ð5¨HÐ5Ñ5Ô5Ñ5Ô5Ð5r   c                 ó*   ‡ — ˆ fd„}|t           _        dS )zþSetup the pytest_assertrepr_compare hook

    The newinterpret and rewrite modules will use util._reprcompare if
    it exists to use custom reporting via the
    pytest_assertrepr_compare hook.  This sets up this custom
    comparison for the test.
    c                 óP  •— ‰j                              ‰j        | ||¬¦  «        }|D ]þ}|rút          d„ |dd…         D ¦   «         ¦  «        dk    r_‰j        j        j        dk     rJt          ¦   «         s<d}t          |¦  «        |z
  }t          j	         
                    d|z  ¦  «        g||d…<   d	„ |D ¦   «         }t          j	         
                    d
¦  «                             |¦  «        }‰j                             d¦  «        dk    r|                     dd¦  «        }|c S ŒÿdS )a1  Call the pytest_assertrepr_compare hook and prepare the result

        This uses the first result from the hook and then ensures the
        following:
        * Overly verbose explanations are dropped unless -vv was used or
          running on a CI.
        * Embedded newlines are escaped to help util.format_explanation()
          later.
        * If the rewrite mode is used embedded %-characters are replaced
          to protect later % formatting.

        The result can be formatted by util.format_explanation() for
        pretty printing.
        )r<   ÚopÚleftÚrightc              3   ó4   K  — | ]}t          |¦  «        V — Œd S r.   )Úlen)r]   Úps     r   r_   z<pytest_runtest_setup.<locals>.callbinrepr.<locals>.<genexpr>†   s(   è è € Ð5Ð5 1�˜A™œÐ5Ð5Ð5Ð5Ð5Ð5r   é   Ni€  rA   é
   zADetailed information truncated (%d more lines), use "-vv" to showc                 ó:   — g | ]}|                      d d¦  «        ‘ŒS )ú
z\n)Úreplace)r]   Úlines     r   ú
<listcomp>z=pytest_runtest_setup.<locals>.callbinrepr.<locals>.<listcomp>Ž   s&   € ÐKÐKÐK¸$˜DŸLšL¨¨uÑ5Ô5ÐKÐKÐKr   z
~r   r   ú%z%%)ÚihookÚpytest_assertrepr_comparer<   ÚsumÚoptionÚverboserb   ri   ÚpyÚbuiltinÚ_totextÚjoinÚgetvaluero   )	re   rf   rg   Úhook_resultÚnew_explÚshow_maxÚtruncated_linesÚresÚitems	           €r   Úcallbinreprz)pytest_runtest_setup.<locals>.callbinreprs   sX  ø€ ð ”j×:Ò:Ø”; 2¨D¸ð ;ñ ?ô ?ˆà#ð 	ð 	ˆHØð ÝÐ5Ð5¨°°°¬Ð5Ñ5Ô5Ñ5Ô5¸Ò<Ð<ØœÔ*Ô2°QÒ6Ð6Ý*Ñ,Ô,ð 7à!�HÝ&)¨(¡m¤m°hÑ&>�OÝ+-¬:×+=Ò+=ð.Ø0?ñ@ñ,Aô ,Að +B�H˜X˜Y˜YÑ'ð LÐKÀ(ÐKÑKÔK�Ý”j×(Ò(¨Ñ/Ô/×4Ò4°XÑ>Ô>�Ø”;×'Ò'¨Ñ5Ô5¸ÒBÐBØŸ+š+ c¨4Ñ0Ô0�CØ�
�
�
ðð	ð 	r   N©r   Ú_reprcompare)r‚   rƒ   s   ` r   Úpytest_runtest_setupr†   k   s-   ø€ ðð ð ð ð ð@ $…DÔÐÐr   c                 ó   — d t           _        d S r.   r„   )r‚   s    r   Úpytest_runtest_teardownrˆ   –   s   € Ø…DÔÐÐr   c                 ó€   — t          | j        dd ¦  «        }|r#|j        �|j                             d ¦  «         d S d S d S rO   rP   rS   s     r   Úpytest_sessionfinishrŠ   š   sS   € Ý˜'œ.¨.¸$Ñ?Ô?€KØð /ØÔÐ'ØÔ×(Ò(¨Ñ.Ô.Ð.Ð.Ð.ð/ð /Ø'Ð'r   )r3   rx   r[   r"   Ú_pytest.assertionr   r   r   r   r   Úobjectr%   r5   rM   rV   rb   r†   rˆ   rŠ   Úassertrepr_comparert   r   r   r   ú<module>rŽ      s>  ððð ð 
€	€	€	Ø 	€	€	€	Ø 
€
€
€
à "Ð "Ð "Ð "Ð "Ð "Ø %Ð %Ð %Ð %Ð %Ð %ð8ð 8ð 8ð@ð @ð @ð$ð $ð $ð0ð ð ð ð �vñ ô ð ðð ð ð ð ñ ô ð ðð ð ð(2ð 2ð 2ð6ð 6ð 6ð($ð ($ð ($ðVð ð ð/ð /ð /ð !Ô3Ð Ð Ð r   