config root man

Current Path : /usr/local/lib/python2.5/test/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/lib/python2.5/test/test_iterlen.pyo

³ò
h”Rc	@sùdZddkZddklZddklZddklZddklZddk	l
ZdZd	„Z
d
ei
fd„ƒYZdefd
„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd efd!„ƒYZd"efd#„ƒYZd$efd%„ƒYZd&efd'„ƒYZd(efd)„ƒYZd*„Zed+joeƒndS(,s¡ Test Iterator Length Transparency

Some functions or methods which accept general iterable arguments have
optional, more efficient code paths if they know how many items to expect.
For instance, map(func, iterable), will pre-allocate the exact amount of
space required whenever the iterable can report its length.

The desired invariant is:  len(it)==len(list(it)).

A complication is that an iterable and iterator can be the same object. To
maintain the invariant, an iterator needs to dynamically update its length.
For instance, an iterable such as xrange(10) always reports its length as ten,
but it=iter(xrange(10)) starts at ten, and then goes to nine after it.next().
Having this capability means that map() can ignore the distinction between
map(func, iterable) and map(func, iter(iterable)).

When the iterable is immutable, the implementation can straight-forwardly
report the original length minus the cumulative number of calls to next().
This is the case for tuples, xrange objects, and itertools.repeat().

Some containers become temporarily immutable during iteration.  This includes
dicts, sets, and collections.deque.  Their implementation is equally simple
though they need to permantently set their length to zero whenever there is
an attempt to iterate after a length mutation.

The situation slightly more involved whenever an object allows length mutation
during iteration.  Lists and sequence iterators are dynanamically updatable.
So, if a list is extended during iteration, the iterator will continue through
the new items.  If it shrinks to a point before the most recent iteration,
then no further items are available and the length is reported at zero.

Reversed objects can also be wrapped around mutable objects; however, any
appends after the current position are ignored.  Any other approach leads
to confusion and possibly returning the same item more than once.

The iterators not listed above, such as enumerate and the other itertools,
are not length transparent because they have no way to distinguish between
iterables that report static length and iterators whose length changes with
each call (i.e. the difference between enumerate('abc') and
enumerate(iter('abc')).

iÿÿÿÿN(ttest_support(trepeat(tdeque(tUserList(tleni
cCsRyt|ƒSWn=tj
o1y|iƒSWqNtj
o
t‚qNXnXdS(N(t_lent	TypeErrort__length_hint__tAttributeError(tobj((s-/usr/local/lib/python2.5/test/test_iterlen.pyR5stTestInvariantWithoutMutationscBseZd„ZRS(cCs|i}xAttdtdƒƒD]&}|it|ƒ|ƒ|iƒq#W|it|ƒdƒ|it|iƒ|it|ƒdƒdS(Nii(	tittreversedtxrangetntassertEqualRtnexttassertRaisest
StopIteration(tselfRti((s-/usr/local/lib/python2.5/test/test_iterlen.pyttest_invariantBs	(t__name__t
__module__R(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR
@stTestTemporarilyImmutablecBseZd„ZRS(cCsz|i}|it|ƒtƒ|iƒ|it|ƒtdƒ|iƒ|it|iƒ|it|ƒdƒdS(Nii(RRRRRtmutateRtRuntimeError(RR((s-/usr/local/lib/python2.5/test/test_iterlen.pyttest_immutable_during_iterationMs	

(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyRKst
TestRepeatcBseZd„Zd„ZRS(cCstdtƒ|_dS(N(RtNoneRR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pytsetUp]scCs|itttdƒƒdS(N(RRRRR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyttest_no_len_for_infinite_repeat`s(RRRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR[s	t
TestXrangecBseZd„ZRS(cCstttƒƒ|_dS(N(titerR
RR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyRfs(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR dstTestXrangeCustomReversedcBseZd„ZRS(cCstttƒƒ|_dS(N(RR
RR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyRks(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR"ist	TestTuplecBseZd„ZRS(cCsttttƒƒƒ|_dS(N(R!ttupleR
RR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyRps(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR#nst	TestDequecBseZd„ZRS(cCs1tttƒƒ}t|ƒ|_|i|_dS(N(RR
RR!RtpopR(Rtd((s-/usr/local/lib/python2.5/test/test_iterlen.pyRws(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR%ustTestDequeReversedcBseZd„ZRS(cCs1tttƒƒ}t|ƒ|_|i|_dS(N(RR
RRRR&R(RR'((s-/usr/local/lib/python2.5/test/test_iterlen.pyR~s(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR(|stTestDictKeyscBseZd„ZRS(cCs4tittƒƒ}t|ƒ|_|i|_dS(N(tdicttfromkeysR
RR!RtpopitemR(RR'((s-/usr/local/lib/python2.5/test/test_iterlen.pyR…s(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR)ƒst
TestDictItemscBseZd„ZRS(cCs4tittƒƒ}|iƒ|_|i|_dS(N(R*R+R
Rt	iteritemsRR,R(RR'((s-/usr/local/lib/python2.5/test/test_iterlen.pyRŒs(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR-ŠstTestDictValuescBseZd„ZRS(cCs4tittƒƒ}|iƒ|_|i|_dS(N(R*R+R
Rt
itervaluesRR,R(RR'((s-/usr/local/lib/python2.5/test/test_iterlen.pyR“s(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR/‘stTestSetcBseZd„ZRS(cCs1tttƒƒ}t|ƒ|_|i|_dS(N(tsetR
RR!RR&R(RR'((s-/usr/local/lib/python2.5/test/test_iterlen.pyRšs(RRR(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR1˜stTestListcBseZd„Zd„ZRS(cCstttƒƒ|_dS(N(R!trangeRR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyR£scCsÐttƒ}t|ƒ}|iƒ|iƒ|it|ƒtdƒ|itƒ|it|ƒtdƒg|d)|it|ƒdƒ|it|ƒgƒ|it	dƒƒ|it|ƒdƒdS(Niiii(
R4RR!RRRtappendtlisttextendR
(RR'R((s-/usr/local/lib/python2.5/test/test_iterlen.pyt
test_mutation¦s



(RRRR8(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR3¡s	tTestListReversedcBseZd„Zd„ZRS(cCstttƒƒ|_dS(N(RR4RR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyR¶scCsÐttƒ}t|ƒ}|iƒ|iƒ|it|ƒtdƒ|itƒ|it|ƒtdƒg|d)|it|ƒdƒ|it|ƒgƒ|it	dƒƒ|it|ƒdƒdS(Niiii(
R4RRRRRR5R6R7R
(RR'R((s-/usr/local/lib/python2.5/test/test_iterlen.pyR8¹s



(RRRR8(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR9´s	tTestSeqItercBseZd„Zd„ZRS(cCsttttƒƒƒ|_dS(N(R!RR4RR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyRÉscCsÖtttƒƒ}t|ƒ}|iƒ|iƒ|it|ƒtdƒ|itƒ|it|ƒtdƒg|d)|it|ƒdƒ|it|ƒgƒ|i	t
dƒƒ|it|ƒdƒdS(Niiii(RR4RR!RRRR5R6R7R
(RR'R((s-/usr/local/lib/python2.5/test/test_iterlen.pyR8Ìs



(RRRR8(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR:Çs	tTestSeqIterReversedcBseZd„Zd„ZRS(cCsttttƒƒƒ|_dS(N(RRR4RR(R((s-/usr/local/lib/python2.5/test/test_iterlen.pyRÜscCsÖtttƒƒ}t|ƒ}|iƒ|iƒ|it|ƒtdƒ|itƒ|it|ƒtdƒg|d)|it|ƒdƒ|it|ƒgƒ|i	t
dƒƒ|it|ƒdƒdS(Niiii(RR4RRRRRR5R6R7R
(RR'R((s-/usr/local/lib/python2.5/test/test_iterlen.pyR8ßs



(RRRR8(((s-/usr/local/lib/python2.5/test/test_iterlen.pyR;Ús	cCsAtttttttttt	t
ttt
g}ti|ŒdS(N(RR R"R#R%R(R)R-R/R1R3R9R:R;Rtrun_unittest(t	unittests((s-/usr/local/lib/python2.5/test/test_iterlen.pyt	test_mainîs	t__main__( t__doc__tunittestttestRt	itertoolsRtcollectionsRRt__builtin__RRRtTestCaseR
RRR R"R#R%R(R)R-R/R1R3R9R:R;R>R(((s-/usr/local/lib/python2.5/test/test_iterlen.pys<module>*s6				


Man Man