/usr/lib/python3.10/unittest/__pycache__
Edit: /usr/lib/python3.10/unittest/__pycache__/util.cpython-310.pyc (4540B)
o
9j_ @ s d Z ddlmZmZ ddlmZ dZdZdZdZ dZ
dZee e e e e
Zedks.J dd Z
d
d Zdd
dZdd Zdd Zdd Zdd ZeddZdd Zdd ZdS )zVarious utility functions. )
namedtupleCounter)commonprefixTP c C sB t | | | }|tkrd| d | || t | | d f } | S )Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskip r $/usr/lib/python3.10/unittest/util.py_shorten s &r c s t tt| } ttt| }|tkr| S t| t t| t t }|t krJtt t | tk s8J t
t| t fdd| D S t
tt t fdd| D S )Nc 3 s | ]} |d V qd S Nr .0r
prefixr r r
' s z'_common_shorten_repr..c 3 s( | ]} t |d tt V qd S r )r
_MIN_DIFF_LEN_MIN_END_LENr r r r r * s )tuplemap safe_reprmaxr _MAX_LENGTHr _MIN_BEGIN_LENr _MIN_COMMON_LENr )argsmaxlen
common_lenr r r _common_shorten_repr s*
r# Fc C sN zt | }W n ty t| }Y nw |rt|tk r|S |d t d S )Nz [truncated]...)repr Exceptionobject__repr__r r )objshortresultr r r r - s r c C s d| j | jf S )Nz%s.%s)
__module____qualname__)clsr r r strclass6 s r. c C s^ d }}g }g } z| | }|| }||k r0| | |d7 }| | |kr/|d7 }| | |ks%n^||krN| | |d7 }|| |krM|d7 }|| |ksCn@|d7 }z&| | |krc|d7 }| | |ksYW |d7 }|| |krx|d7 }|| |ksnn|d7 }|| |kr|d7 }|| |ksw W n ty || |d |||d Y ||fS w q )ar Finds elements in only one or the other of two, sorted input lists.
Returns a two-element tuple of lists. The first list contains those
elements in the "expected" list but not in the "actual" list, and the
second contains those elements in the "actual" list but not in the
"expected" list. Duplicate elements in either input list are ignored.
r T N)append
IndexErrorextend)expectedactualijmissing
unexpectedear r r sorted_list_difference9 sX
r; c C sH g }| r | }z|| W n ty || Y nw | s||fS )zSame behavior as sorted_list_difference but
for lists of unorderable items (like dicts).
As it does a linear search per item (remove) it
has O(n*n) performance.)popremove
ValueErrorr0 )r3 r4 r7 itemr r r unorderable_list_differenceb s r@ c C s | |k| |k S )z.Return -1 if x < y, 0 if x == y and 1 if x > yr )xyr r r
three_way_cmps s rC Mismatchzactual expected valuec C s, t | t |}}t|t|}}t }g }t|D ]G\}} | |u r$qd }
}t||D ]}|| | kr=|
d7 }
|||<