Your IP : 216.73.216.213


Current Path : /opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyo

�
�mYc@`s�dZddlmZmZmZddlZddlZdZdZdZ	dd�Zd�Zd	�Z
ddd
�Zd�ZdS(
s�
Utilities 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.
i(tabsolute_importtdivisiontprint_functionNiiPsuse '-vv' to showcC`st|�rt|�S|S(sQ
    Truncate this assertion explanation if the given test item is eligible.
    (t_should_truncate_itemt_truncate_explanation(texplanationtitemt
max_length((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyttruncate_if_requireds
cC`s#|jjj}|dko"t�S(sC
    Whether or not this test item is eligible for truncation.
    i(tconfigtoptiontverboset_running_on_ci(RR((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyRscC`s ddg}td�|D��S(s0Check if we're currently running on a CI system.tCItBUILD_NUMBERcs`s|]}|tjkVqdS(N(tostenviron(t.0tvar((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pys	<genexpr>&s(tany(tenv_vars((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyR#scC`s)|d	krt}n|d	kr*t}ntdj|��}t|�|kra||kra|S|| }t||�}|dd|d<t|�t|�}|d7}d}|dkr�|dj|�7}n|dj|�7}|djt�7}|jt	j
jd�t	j
j|�g�|S(
s�
    Truncate given list of strings that makes up the assertion explanation.

    Truncates to either 8 lines, or 640 characters - whichever the input reaches
    first. The remaining lines will be replaced by a usage message.
    ti����s...is...Full output truncateds ({0} line hidden)s ({0} lines hidden)s, {0}N(tNonetDEFAULT_MAX_LINEStDEFAULT_MAX_CHARStlentjoint_truncate_by_char_counttformatt	USAGE_MSGtextendtpytbuiltint_totext(tinput_linest	max_linest	max_charstinput_char_countttruncated_explanationttruncated_line_counttmsg((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyR)s*		

cC`s�tdj|��|kr|Sd}xDt|�D]6\}}|t|�|krXPn|t|�7}q2W|| }||}|r�||}|| }n|j|�|S(NRi(RRt	enumeratetappend(R"R$titerated_char_counttiterated_indext
input_linettruncated_resultt
final_linetfinal_line_truncate_point((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyRSs




i�(t__doc__t
__future__RRRRRRRRRRRRRR(((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/truncate.pyt<module>s			*