
    [j                    z   U d 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 ddlm Z  ddlm!Z! d	Z"de#d<   d	Z$de#d<   d	Z%de#d<   dZ&dZ'de#d<   d Z(d!e#d"<   e'e(fZ)d<d'Z*d=d)Z+d>d,Z,d?d.Z-d@d1Z.dAd;Z/d	S )Bz"Utilities for assertion debugging.    )annotations)Callable)Iterator)Sequence)Literal)	normalize)outcomesN)saferepr)saferepr_unlimited)_compare_eq_any)SET_COMPARISON_FUNCTIONS)isset)istext)_AssertionTextDiffStyle)_HighlightFunc)_notin_text)dummy_highlighter)Config)
UsageErrorz2Callable[[str, object, object], str | None] | None_reprcomparez&Callable[[int, str, str], None] | None_assertion_passzConfig | None_configassertion_text_diff_stylendiffzLiteral['ndiff']ASSERTION_TEXT_DIFF_STYLE_NDIFFblockzLiteral['block']ASSERTION_TEXT_DIFF_STYLE_BLOCKconfigr   returnr   c                    t          |                     t                              }|xdk    rn	xdk    rn n |S 	 d                    d t          D                       }t          t           d| d|          )Nr   r   z, c              3  4   K   | ]}t          |          V  d S N)repr).0choices     Z/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/_pytest/assertion/util.py	<genexpr>z0get_assertion_text_diff_style.<locals>.<genexpr>8   s9          !'V               z must be one of z; got )strgetiniASSERTION_TEXT_DIFF_STYLE_INIjoin!ASSERTION_TEXT_DIFF_STYLE_CHOICESr   )r   stylechoicess      r&   get_assertion_text_diff_styler0   2   s    ;<<==E
WWWWwwwwwwwwLii    +L       G 0ZZ'ZZQVZZ  r(   Nonec                $    t          |            d S r"   )r0   )r   s    r&   "validate_assertion_text_diff_styler3   @   s    !&)))))r(   explanationr)   c                h    t          |           }t          |          }d                    |          S )a  Format an explanation.

    Normally all embedded newlines are escaped, however there are
    three exceptions: \n{, \n} and \n~.  The first two are intended
    cover nested explanations, see function and attribute explanations
    for examples (.visit_Call(), visit_Attribute()).  The last one is
    for when one explanation needs to span multiple lines, e.g. when
    displaying diffs.
    
)_split_explanation_format_linesr,   )r4   linesresults      r&   format_explanationr;   D   s0     {++E5!!F99Vr(   	list[str]c                    | pd                     d          }|d         g}|dd         D ]7}|r |d         dv r|                    |           $|dxx         d|z   z  cc<   8|S )	zReturn a list of individual lines in the explanation.

    This will return a list of lines split on '\n{', '\n}' and '\n~'.
    Any other newlines will be escaped and appear in the line as the
    literal '\n' characters.
     r6   r      N){}~>z\n)splitappend)r4   	raw_linesr9   valuess       r&   r7   r7   S   s     "))$//Iq\NEABB- ( ( 	(fQi#777LL    "III'IIIILr(   r9   Sequence[str]c                r   t          | dd                   }dg}dg}| dd         D ]x}|                    d          r|d         rd}nd}|                    t          |                     |dxx         dz  cc<   |                    d           |                    dd	t          |          dz
  z  z   |z   |dd         z              |                    d
          rH|                                 |                                 ||d         xx         |dd         z  cc<   |d         dv sJ |dxx         dz  cc<   |                    d          rt          |          nt          |          dz
  }|                    d	|z  |dd         z              zt          |          dk    sJ |S )a  Format the individual lines.

    This will replace the '{', '}' and '~' characters of our mini formatting
    language with the proper 'where ...', 'and ...' and ' + ...' text, taking
    care of indentation along the way.

    Return a list of formatted lines.
    Nr?   r   r@   rD   zand   zwhere z +z  rA   )rB   rC   rB   )list
startswithrF   lenpop)r9   r:   stackstackcntlinesindents          r&   r8   r8   d   s    %)__FCEsHabb	 4 4??3 	4| LLV%%%RLLLALLLOOAMM$Ua!881<tABBxGHHHH__S!! 	4IIKKKLLNNN59abb)7j(((("IIINIII#'??3#7#7KSZZZSZZ!^FMM$-$qrr(23333u::????Mr(   opleftobjectrightverboseinthighlighterr   Iterator[str]c             #    K   t          |t                    o6t          |t                    o!t          d|          t          d|          k    }|dk    r#t          ||          }t          ||          }n<dt	          |           z
  dz
  dz  }	t          ||	|          }t          ||	|          }| d|  d| }
	 | dk    rt          |||||          }n| d	k    r0t          |          r!t          |          rt          |||          }nJ| d
v r7t          |          r(t          |          rt          |          ||||          }nt          d          }d}|D ]}|s|
V  |dk    rdV  d}|V  dS # t          j        $ r  t          $ rQ t          j        j                                                                        }|s
|
V  dV  d}d| dV  dV  Y dS w xY w)a"  Yield specialised explanations for some operators/operands.

    The first line yielded is always the summary (``left op right``);
    subsequent lines are the detailed explanation. Yields nothing when no
    specialised explanation applies, which lets consumers map an empty
    iterator to "no explanation" without materialising anything.

    The iterator is lazy on purpose: a streaming consumer can stop pulling
    lines as soon as it has enough to show, so an enormous diff doesn't
    have to be built in full just to be thrown away.
    NFDr?   )	use_asciiA      )maxsizer^    z==znot in>   !=<=>=<rC    Fr>   Tz<(pytest_assertion plugin: representation of details failed: .z+ Probably an object has a faulty __repr__.)N)
isinstancer)   r   r   rM   r
   r   r   r   r   r   iterr	   Exit	Exception_pytest_codeExceptionInfofrom_current_getreprcrash)rT   rU   rW   rX   rZ   r   r^   	left_repr
right_reprra   summarysourcesummary_yieldedrQ   
repr_crashs                  r&   assertrepr_comparerx      s     . 	4 	>uc""	>eT""iu&=&==  {{&tyAAA	'CCC


 c"gg! T7iHHH	eW	JJJ
..R..*..G%<::$) FF 8^^t^^ ug66FF///E$KK/E%LL/-b1${GTTFF"XXF   	 	D" '2::HHH"&JJJJ	 	 =    	< 	< 	<]0==??MMOO
 	#MMMHHH"OX:XXX	
 	
 	
 <;;;;;;	<s   ?B7E8 8A&G"!G")r   r   r   r   )r   r   r   r1   )r4   r)   r   r)   )r4   r)   r   r<   )r9   rI   r   r<   )rT   r)   rU   rV   rW   rV   rX   rY   rZ   r   r   r   r   r[   )0__doc__
__future__r   collections.abcr   r   r   typingr   unicodedatar   rm   r	   _pytest._code_pytest._io.safereprr
   r   _pytest.assertion._compare_anyr   _pytest.assertion._compare_setr   _pytest.assertion._guardsr   r   _pytest.assertion._typingr   r   _pytest.assertion.compare_textr   _pytest.assertion.highlightr   _pytest.configr   r   r   __annotations__r   r   r+   r   r   r-   r0   r3   r;   r7   r8   rx   rg   r(   r&   <module>r      sl   ( ( ( " " " " " " $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $       ! ! ! ! ! !           ) ) ) ) ) ) 3 3 3 3 3 3 : : : : : : C C C C C C + + + + + + , , , , , , = = = = = = 4 4 4 4 4 4 6 6 6 6 6 6 N N N N N N ! ! ! ! ! ! % % % % % % DH G G G G ;? > > > >      ; 4;  ; ; ; ;4;  ; ; ; ;##% !   * * * *      "       FP< P< P< P< P< P<r(   