
    i=                        S r SSKJr  SSKJr  SSKJr  SSKJr  Sr	\	S-  r
SrSS	 jrSS
 jr        SS jrSS jrg)zUtilities for truncating assertion output.

Current default behaviour is to truncate assertion explanations at
terminal lines, unless running with an assertions verbosity level of at least 2 or running on CI.
    )annotations)util)Config)Item   P   zuse '-vv' to showc                F    [        U5      u  p#nU(       a  [        U UUS9$ U $ )zGTruncate this assertion explanation if the given test item is eligible.)	max_lines	max_chars)_get_truncation_parameters_truncate_explanation)explanationitemshould_truncater
   r   s        Y/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/_pytest/assertion/truncate.pytruncate_if_requiredr      s2    ,Ft,L)O	$
 	

     c                   U R                   R                  S5      n[        Ub  UO[        5      nU R                   R                  S5      n[        Ub  UO[        5      nU R                   R                  [        R                  5      nUS:  =(       a    [        R                  " 5       (       + nU=(       a    US:  =(       d    US:  nXAU4$ )zgReturn the truncation parameters related to the given item, as (should truncate, max lines, max chars).truncation_limit_linestruncation_limit_chars   r   )
configgetiniintDEFAULT_MAX_LINESDEFAULT_MAX_CHARSget_verbosityr   VERBOSITY_ASSERTIONSr   running_on_ci)r   r
   r   verboser   s        r   r   r      s     ""#;<I!6I<MNI""#;<I!6I<MNIkk''(C(CDGk>$*<*<*>&>O%J9q=+IIMOy00r   c                   [        SR                  U 5      5      nUS-   nUS-   n[        U 5      U::  a  X4::  a  U $ US:  a  U SU nOU nSn[        SR                  U5      5      U:  a  US:  a  [        Xb5      nOSnX`:X  a  U$ [        U 5      [        U5      -
  nUS   (       a  US   S	-   US'   U(       a  US
-  nOS	US'   / UQSPSU SUS
:X  a  SOS S[         3P$ )a  Truncate given list of strings that makes up the assertion explanation.

Truncates to either max_lines, or max_chars - whichever the input reaches
first, taking the truncation explanation into account. The remaining lines
will be replaced by a usage message.
 F   r   r   NTFz...   z...Full output truncated (z linesz
 hidden), )lenjoin_truncate_by_char_count	USAGE_MSG)	input_linesr
   r   input_char_counttolerable_max_charstolerable_max_linestruncated_explanationtruncated_chartruncated_line_counts	            r   r   r   4   sA    277;/0 	B  $a-K//31} +JY 7 +N
277()*-@@YQR] 7!!
 +$${+c2G.HHR $9"$=$Eb! A%  %*b!	
 %%9$:%%*2
4Jyk	K r   c                    Sn[        U 5       H'  u  p4U[        U5      -   U:  a    OU[        U5      -  nM)     U S W nX   nU(       a	  X-
  nUS U nUR                  U5        U$ )Nr   )	enumerater'   append)r+   r   iterated_char_countiterated_index
input_linetruncated_result
final_linefinal_line_truncate_points           r   r)   r)   z   s    &/&<"Z09<s:. '= #?N3,J$-$C! :!:;
J'r   N)r   	list[str]r   r   returnr;   )r   r   r<   ztuple[bool, int, int])r+   r;   r
   r   r   r   r<   r;   )r+   r;   r   r   r<   r;   )__doc__
__future__r   _pytest.assertionr   _pytest.configr   _pytest.nodesr   r   r   r*   r   r   r   r)    r   r   <module>rC      sn    # " !   %* 		1*CCC C 	CLr   