bg dZddlmZddlmZddlmZddlmZdZdZ dZ dd ee d ed ee d ee fdZ d ed efdZ ddee dee dee d ee fdZdee de d ee fdZd 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)Itemizuse '-vv' to showN explanationitem max_lengthreturncBt|rt|S|S)zGTruncate this assertion explanation if the given test item is eligible.)_should_truncate_item_truncate_explanation)rr r s k/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/assertion/truncate.pytruncate_if_requiredrs(T""2$[111 cX|jjj}|dkotj S)z9Whether or not this test item is eligible for truncation.)configoptionverboser running_on_ci)r rs rr r s*k (G Q; 3t13333r input_lines max_lines max_charsc|t}|t}td|}|dz}|dz}t||kr||kr|S|d|}d}td||krt ||}nd}t|t|z }|dr|ddz|d<|r|d z }nd|d<|dd |d |d krdnd d t gzS)aTruncate 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. NFrTFz...z...Full output truncated (z linesz hidden), )DEFAULT_MAX_LINESDEFAULT_MAX_CHARSlenjoin_truncate_by_char_count USAGE_MSG) rrrinput_char_counttolerable_max_charstolerable_max_linestruncated_explanationtruncated_chartruncated_line_counts rrr!s% % 277;//00 B$a- K///  3 3 3'  3N 277( ) )**-@@@ 7 !9! ! {++c2G.H.HHR *$9"$=$Eb!  & A % %*b!   K%9 K K%**22 K K?H K K$ rcd}t|D]/\}}|t|z|krn|t|z }0|d|}||}|r||z }|d|}|||S)Nr) enumerater#append)rriterated_char_countiterated_index input_linetruncated_result final_linefinal_line_truncate_points rr%r%ds&/ &<&<//" Z 09 < < Es:.#?N?3^,J<$-0C$C! :!: :; J''' r)N)NN)__doc__typingrr_pytest.assertionr _pytest.nodesrr!r"r&strintrboolr rr%rrr>st """"""  EIc"&4