
    	h              
          d Z ddlmZ ddlmZ ddlmZ ddlmZ dZdZ	dZ
	 dd
ee         dedee         dee         fdZdedefdZ	 	 ddee         dee         dee         dee         fdZdee         dedee         fdZd	S )zUtilities for truncating assertion output.

Current default behaviour is to truncate assertion explanations at
~8 terminal lines, unless running in "-vv" mode or running on CI.
    )List)Optional)util)Item   i  zuse '-vv' to showNexplanationitem
max_lengthreturnc                 B    t          |          rt          |           S | S )zGTruncate this assertion explanation if the given test item is eligible.)_should_truncate_item_truncate_explanation)r   r	   r
   s      g/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/_pytest/assertion/truncate.pytruncate_if_requiredr      s(     T"" 2$[111    c                 X    | j         j        j        }|dk     ot          j                     S )z9Whether or not this test item is eligible for truncation.   )configoptionverboser   running_on_ci)r	   r   s     r   r   r      s*    k (GQ;3t13333r   input_lines	max_lines	max_charsc                    |t           }|t          }t          d                    |                     }|dz   }|dz   }t          |           |k    r||k    r| S | d|         }d}t          d                    |                    |k    rt	          ||          }nd}t          |           t          |          z
  }|d         r|d         dz   |d<   |r|d	z  }nd|d<   |dd
| d|d	k    rdnd dt
           gz   S )a  Truncate given list of strings that makes up the assertion explanation.

    Truncates to either 8 lines, or 640 characters - whichever the input reaches
    first, taking the truncation explanation into account. The remaining lines
    will be replaced by a usage message.
    N F   r   TFz...   z...Full output truncated (z linesz
 hidden), )DEFAULT_MAX_LINESDEFAULT_MAX_CHARSlenjoin_truncate_by_char_count	USAGE_MSG)	r   r   r   input_char_counttolerable_max_charstolerable_max_linestruncated_explanationtruncated_chartruncated_line_counts	            r   r   r   !   s    %	%	 277;//00 	B  $a-K/// 333'

3N
277())**-@@@ 7!9!
 !
 {++c2G.H.HHR  *$9"$=$Eb! 	& A%  %*b! 
	K%9 	K 	K%**22	K 	K?H	K 	K$  r   c                     d}t          |           D ]/\  }}|t          |          z   |k    r n|t          |          z  }0| d |         }| |         }|r||z
  }|d |         }|                    |           |S )Nr   )	enumerater#   append)r   r   iterated_char_countiterated_index
input_linetruncated_result
final_linefinal_line_truncate_points           r   r%   r%   d   s    &/&<&< / /"
Z09<<Es:. #?N?3^,J <$-0C$C! :!: :;
J'''r   )N)NN)__doc__typingr   r   _pytest.assertionr   _pytest.nodesr   r!   r"   r&   strintr   boolr   r   r%    r   r   <module>r>      st   
             " " " " " "         	 EI c"&4<SM	#Y   4 4 4 4 4 4  $#@ @c@}@ }@ 
#Y	@ @ @ @Fc s tCy      r   