Current File : //opt/imh-python/lib/python2.7/test/test_bisect.pyc
�
��Wc@s�ddlZddlZddlmZddlmZdejd<dejkraejd=nddlZejd=ejd=ddlZde	fd��YZ
d	ejfd
��YZdefd��YZ
d
efd��YZdejfd��YZdefd��YZdefd��YZdd&d��YZdd'd��YZdd(d��YZdejfd��YZdefd��YZdefd ��YZd!Zied"6Zdd#�Zed$kr�ed%e�ndS()i����N(ttest_support(tUserListit_bisecttbisecttRangecBs2eZdZd�Zd�Zd�Zd�ZRS(sEA trivial xrange()-like object without any integer width limitations.cCs||_||_d|_dS(N(tstarttstoptNonetlast_insert(tselfRR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt__init__s		cCs|j|jS(N(RR(R	((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt__len__!scCsO|j|j}|dkr)||7}n||krDt|��n|j|S(Ni(RRt
IndexError(R	tidxtn((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt__getitem__$s
cCs||f|_dS(N(R(R	R
titem((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pytinsert,s(t__name__t
__module__t__doc__R
RRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRs
			t
TestBisectcBsbeZd
Zd�Zd�Zd�Zd�Zd�Zdd�Z	d�Z
d�Zd	�ZRS(cXCsu
|jjgddf|jjdgddf|jjdgddf|jjdgddf|jjddgddf|jjddgddf|jjddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjddgddf|jjddgddf|jjddgddf|jjddgddf|jjddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
d	df|jjddddddddddg
dd
f|jjddddddddddg
dd
f|jjgddf|jjdgddf|jjdgddf|jjdgddf|jjddgddf|jjddgddf|jjddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjddgddf|jjddgddf|jjddgddf|jjddgddf|jjddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjddddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjdddgddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
ddf|jjddddddddddg
d	df|jjddddddddddg
ddf|jjddddddddddg
dd
fgN|_dS(Niiiiig�?g@ig@i
i(tmoduletbisect_righttbisect_lefttprecomputedCases(R	((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pytsetUp3s�!!!!!!!!333333333!!!!!!!!33333333cCs\xU|jD]J\}}}}|j|||�|�|j|t|�|�|�q
WdS(N(RtassertEqualR(R	tfunctdatatelemtexpected((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_precomputed�scCs�|j}|jt|jdddgddd�f|jt|jdddgddd�f|jt|jdddgddd�f|jt|jdddgddd�fdS(Niiiii����(RtassertRaisest
ValueErrorRRtinsort_lefttinsort_right(R	tmod((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_negative_lo�s
	+++cCs�|j}tj}yt|d�}Wntk
rF|jd�nX|j|j||d�|d�|j|j||d�|d�|j|j||d|d|�|d�|j|j||d|d|�|d�dS(Nis4can't create a xrange() object of size `sys.maxsize`iii
(	Rtsystmaxsizetxranget
OverflowErrortskipTestRRR(R	R%RR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_large_range�s		
$$.cCsS|j}tj}td|d�}|j|j||d�|d�|j|j||d�|d�|j|j||d|d|�|d�|j|j||d|d|�|d�|d}|j|||d|d�|j|j||f�|d}|j	|||d|d�|j|j|d|f�dS(	Niiiii
idi2i�(
RR'R(RRRRR#RR$(R	R%RRtx((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_large_pyrange�s		$$..

icCsIddlm}x2t|�D]$}gt|�D]}|d|d�^q0}|j�|d|d�}|jj||�}|t|�kr�|j|||k�n|dkr�|j||d|k�n|jj||�}|t|�kr|j|||k�n|dkr|j||d|k�qqWdS(Ni����(t	randrangeiii(	trandomR/R)tsortRRtlent
assertTrueR(R	RR/titjRRtip((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_random�s+
c
Cs�x�|jD]�\}}}}x�td�D]�}tt|�|�}xntdd�D]]}tt|�|�}|||||�}|j||ko�|kn�||jjkr�||kr�|j|||k�n||jjkr||kr|j||d|k�n||jjkrS||krS|j|||k�n||jjkr�||kr�|j||d|k�n|j|t	|t||���qTWq)Wq
WdS(Niiii(
RR)tminR2R3RRRRtmax(R	RRRRtlothiR6((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_optionalSlicing�s #cCs |j|jj|jj�dS(N(RRRR(R	((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_backcompatibility�sc
CsCdddddg}|j|jjd|ddd	d
dd�d
�|j|jjd|ddd	d
dd�d
�|j|jjd|ddd	d
dd�d
�|jjd|ddd	d
dd�|jjd|ddd	d
dd�|jjd|ddd	d
dd�|j|ddddddddg�dS(Ni
iii(i2taR-iR:iR;ii(RRRRRR#R$tinsort(R	R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_keyword_args�s111%%%N(
RRRRRR R&R,R.R7R<R=R@(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyR0s	S			
			tTestBisectPythoncBseZeZRS((RRt	py_bisectR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRA�stTestBisectCcBseZeZRS((RRtc_bisectR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRC�st
TestInsortcBs,eZdZdd�Zd�Zd�ZRS(i�cCs�ddlm}x�t�t�fD]s}xTt|�D]F}|d�}|dkrc|jj}n|jj}|||�q6W|jt	|�|�q#WdS(Ni����(tchoicet
0123456789t02468(
R0RFtlistRR)RR#R$Rtsorted(R	RRFtinsortedR4tdigittf((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_vsBuiltinSort�scCs |j|jj|jj�dS(N(RRR?R$(R	((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyR=�scCsbdtfd��Y}|�}|jj|d�|jj|d�|jddg|j�dS(NtListcBseZgZd�ZRS(cSs|jj||�dS(N(RR(R	tindexR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyR�s(RRRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRO�si
i(RIRR#R$RR(R	ROtlst((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_listDerived�s
	N(RRRRRNR=RR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRE�s	tTestInsortPythoncBseZeZRS((RRRBR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRSstTestInsortCcBseZeZRS((RRRDR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRTstLenOnlycBseZdZd�ZRS(s:Dummy sequence class defining __len__ but not __getitem__.cCsdS(Ni
((R	((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRs(RRRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRUstGetOnlycBseZdZd�ZRS(s:Dummy sequence class defining __getitem__ but not __len__.cCsdS(Ni
((R	tndx((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRs(RRRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRVstCmpErrcBseZdZd�ZRS(s;Dummy element that always raises an error during comparisoncCs
t�dS(N(tZeroDivisionError(R	tother((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt__cmp__s(RRRR[(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRXstTestErrorHandlingcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(cCsOxH|jj|jj|jj|jjfD]}|jt|dd�q+WdS(Ni
(RRRR#R$R!t	TypeError(R	RM((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_non_sequence scCsRxK|jj|jj|jj|jjfD]}|jt|t�d�q+WdS(Ni
(RRRR#R$R!tAttributeErrorRU(R	RM((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt
test_len_only%scCsRxK|jj|jj|jj|jjfD]}|jt|t�d�q+WdS(Ni
(RRRR#R$R!R_RV(R	RM((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt
test_get_only*scCsgt�t�t�g}xH|jj|jj|jj|jjfD]}|jt||d�qCWdS(Ni
(RXRRRR#R$R!RY(R	tseqRM((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_cmp_err/scCsLxE|jj|jj|jj|jjfD]}|jt|d�q+WdS(Ni
(RRRR#R$R!R](R	RM((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyttest_arg_parsing5sN(	RRRRR^R`RaRcRd(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyR\s				tTestErrorHandlingPythoncBseZeZRS((RRRBR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRe:stTestErrorHandlingCcBseZeZRS((RRRDR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyRf=ss_
Example from the Library Reference:  Doc/library/bisect.rst

The bisect() function is generally useful for categorizing numeric data.
This example uses bisect() to look up a letter grade for an exam total
(say) based on a set of ordered numeric breakpoints: 85 and up is an `A',
75..84 is a `B', etc.

    >>> grades = "FEDCBA"
    >>> breakpoints = [30, 44, 66, 75, 85]
    >>> from bisect import bisect
    >>> def grade(total):
    ...           return grades[bisect(breakpoints, total)]
    ...
    >>> grade(66)
    'C'
    >>> map(grade, [33, 99, 77, 44, 12, 88])
    ['E', 'A', 'B', 'D', 'F', 'A']

t
libreftestcCs�ddlm}ttttttg}tj	|�tj
||�|r�ttd�r�ddl
}dgd}xAtt|��D]-}tj	|�|j�tj�||<q�W|GHndS(Ni����(ttest_bisecttgettotalrefcounti(ttestRhRARCRSRTReRfRtrun_unittesttrun_doctestthasattrR'tgcRR)R2tcollectRi(tverboseRhttest_classesRntcountsR4((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt	test_main[s



t__main__Rp((((R'tunittestRjRRtmodulesRRBRDtobjectRtTestCaseRRARCRERSRTRURVRXR\ReRfRgt__test__RRsRtTrue(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_bisect.pyt<module>s8



�