ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
P\¬Qc@sædZddlZddlmZmZmZddlmZddlZddl    Z    ddl
m
Z
ddl m Z m Z dd„Zd    „Zd
ejfd „ƒYZd ejfd „ƒYZd„ZedkrâeƒndS(s,
Tests for fileinput module.
Nick Mathewson
iÿÿÿÿN(tverbosetTESTFNt run_unittest(tunlink(tStringIO(t    FileInputt hook_encodedtwcCs:tt|ƒ}t||ƒ}|j|ƒ|jƒ|S(N(Rtstrtopent
writelinestclose(titlinestmodetnametf((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pytwriteTmps
 
cGsx|D]}t|ƒqWdS(N(t safe_unlink(tnamesR((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pytremove_tempfiless tBufferSizesTestscBs eZd„Zddd„ZRS(c    CsxddfD]\}}zàtdgtdƒD]}d|d^q/ƒ}tdgtdƒD]}d|d^q_ƒ}td    gtd
ƒD]}d |d^qƒ}td gtdƒD]}d |d^q¿ƒ}|j||||||ƒWdt||||ƒXq WdS(NiiiisLine %s of file 1
ii
sLine %s of file 2
iisLine %s of file 3
isLine %s of file 4
(ii(ii(Rtrangetbuffer_size_testR(tselftroundtbsR tt1tt2tt3tt4((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyttest_buffer_sizes s0000 icCstjdƒ}d|d}tr9d|d|fGHntd||||fd|ƒ}    t|    ƒ}
|    jƒ|jt|
ƒdƒ|j|
d    d
ƒ|j|
d d ƒ|j|    jƒdƒ|j|    j    ƒ|ƒtröd |d|fGHntd||||fd|ƒ}    d} x"| rA| dkrA|    j
ƒ} q W|j|    j    ƒ|ƒ|j|    jƒdƒ|j|    j ƒdƒ|j |    j ƒƒ|j |    jƒƒtrÆd|d|fGHn|    jƒ|j|    j
ƒdƒ|j|    jƒdƒ|    jƒtr"d|d|fGHntd||||dfd|ƒ}    tj} zitdƒt_t|    ƒ}
|jt|
ƒdƒ|j|
ddƒ|j|    j    ƒdƒ|    jƒWd| t_Xtrád|d    |fGHntd||||fd|ƒ}    |j|    jƒdƒ|j|    j    ƒdƒ|    jƒ|j|    jƒdƒ|j|    j    ƒdƒtr€d|d|fGHntj} z[td||||fd dd|ƒ}    x#|    D]}|d! jƒ}|GHqºW|    jƒWd| t_Xtd||||fd|ƒ}    xj|    D]b}|j|d!d"ƒ|j|d! ƒ}|j|dƒ|jt|jdƒƒ|    j ƒƒqW|    jƒdS(#NsLINE (\d+) OF FILE (\d+)iis%s. Simple iteration (bs=%s)itfilestbufsizeiisLine 5 of file 1
isLine 1 of file 4
s%s. Status variables (bs=%s)txsLine 6 of file 2
is%s. Nextfile (bs=%s)isLine 1 of file 3
is%s. Stdin (bs=%s)it-s Line 1 of stdin
Line 2 of stdin
i!i sLine 2 of stdin
s<stdin>s%s. Boundary conditions (bs=%s)s%s. Inplace (bs=%s)itinplaceiÿÿÿÿs
(tretcompileRRtlistR t assertEqualtlentlinenotfilenametreadlinet
filelinenot assertFalset isfirstlinetisstdintnextfiletsyststdinRtNonetstdouttuppertmatchtassertNotEqualtinttgroup(RRRRRRRtpattstarttfiR tst    savestdint
savestdouttlinetm((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyR,s„! 
!
 
$     
!
    '     
! )(t__name__t
__module__RR(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyRs     tFileInputTestscBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsEz*tddgƒ}tddgƒ}tddgƒ}tddgƒ}td||||fƒ}|jƒ}|j|dƒ|j|jƒdƒ|j|jƒdƒ|j|jƒ|ƒ|jƒ}|j|ƒ|j|jƒdƒ|j|jƒdƒ|j|jƒ|ƒ|jƒWdt    ||||ƒXdS(    NitiisThe only line there is.
iR i(
RRR,R(R*R-R+R.R R(RRRRRR=RA((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyttest_zero_byte_fileszs$   cCs¬z—tddgƒ}tddgƒ}td||fƒ}t|ƒ}|j|dddd    d
d gƒ|j|jƒd ƒ|j|jƒd ƒWdt||ƒXdS(NisA
B
CisD
E
FR sA
sB
tCsD
sE
tFii(RRR'R(R-R*R(RRRR=R ((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyt%test_files_that_dont_end_with_newline‘s "cCsƒzqtddgƒ}tjƒ}|dkr6d}ntdt||ƒƒ}t|ƒ}|j|ddgƒWdt|ƒXdS(NisA
BtasciiR sA
tB(    RR2tgetfilesystemencodingR4RtunicodeR'R(R(RRtencodingR=R ((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyttest_unicode_filenamess       cCsÌz·tddgƒ}tddgƒ}td||fƒ}|j|jƒdƒ|jƒ}|j|jƒdƒ|jƒ|j|jƒdƒt|ƒ}|j|jƒdƒWdt||ƒXdS(NisA
BisC
DR iÿÿÿÿ(    RRR(tfilenotnextR8R1R'R(RRRR=RA((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyt test_fileno©s 
 cCsŸy tddƒ}|jdƒWntk
r3nXzYtddgddƒ}td|ddƒ}t|ƒ}|j|d    d
d d gƒWdt|ƒXdS( NRRs-FileInput should reject invalid mode argumentisA
B
C DtwbR tUsA
sB
sC
tD(Rtfailt
ValueErrorRR'R(R(RR=RR ((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyttest_opening_mode¸s   cCsÜy)tdddd„ƒ}|jdƒWntk
r<nXy tddƒ}|jdƒWntk
rpnXzYtddgdd    ƒ}td
|dtd ƒƒ}t|ƒ}|j|d d gƒWdt|ƒXdS(NR$itopenhookcSsdS(N(R4(RRB((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyt<lambda>ËssGFileInput should raise if both inplace and openhook arguments are givens2FileInput should check openhook for being callablesA
BRRTR trot13sN
tO(RRWRXRRR'R(R(RR=RR ((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyttest_file_opening_hookÈs    (RCRDRGRJRPRSRYR^(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyREys                     cCstttƒdS(N(RRRE(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyt    test_mainÝst__main__(t__doc__tunittestttest.test_supportRRRRRR2R%Rt    fileinputRRRRtTestCaseRRER_RC(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_fileinput.pyt<module>s          Zd