tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
R\¬Qc@sQdZddlZddlZddlZddlZddlZddlZddlZddlZddl    m
Z
ddl m Z m Z ejƒ r«ejdƒ‚nejjejjejjejjeƒƒƒdƒZejjedƒZdejfd    „ƒYZd
ejfd „ƒYZd „Zed krMejƒndS(sºTests for scripts in the Tools directory.
 
This file contains regression tests for some of the scripts found in the
Tools directory of a Python checkout or tarball, such as reindent.py.
iÿÿÿÿN(t test_support(tassert_python_okttemp_dirs'test irrelevant for an installed PythontToolstscriptst ReindentTestscBs/eZejjedƒZd„Zd„ZRS(s reindent.pycCst|jƒdS(N(Rtscript(tself((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt test_noargsscCs?t|jdƒ\}}}|j|dƒ|j|dƒdS(Ns-ht(RRt assertEqualt assertGreater(Rtrctoutterr((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt    test_help"s(    t__name__t
__module__tostpathtjoint
scriptsdirRRR(((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyRs    t PindentTestscBs€eZejjedƒZd„Zd„Zd„Z    d„Z
d„Z d„Z d„Z d„Zd    „Zd
„Zd „ZRS( s
pindent.pyc CsJt|ƒ8}t|ƒ#}|j|jƒ|jƒƒWdQXWdQXdS(N(topenR
t    readlines(Rtfn1tfn2tf1tf2((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pytassertFileEqual+scGs]tjtj|jf|dtjdtjdtƒ}|j|ƒ\}}|j|ƒ|S(Ntstdintstdouttuniversal_newlines(    t
subprocesstPopentsyst
executableRtPIPEtTruet communicatet assertIsNone(RtsourcetargstprocR R((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pytpindent/s     cCs!djd„|jƒDƒƒdS(Ns
css|]}|jƒVqdS(N(tlstrip(t.0tline((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pys    <genexpr>9s(Rt
splitlines(Rtdata((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt lstriplines8sc Csðd|_tƒØ}tjj|dƒ}t|jƒ}|jƒ}WdQXt|dƒ}|j    |ƒWdQXt
|jd|ƒ\}}}|j |dƒ|j |dƒ|d}|j tjj |ƒƒt|ƒ}|j |jƒ|ƒWdQXt|ƒ}|jƒ}    WdQXt|    ddƒ|j |j|    dƒ|ƒ|j |j|dƒ|    ƒt
|jd|ƒ\}}}|j |dƒ|j |dƒt|ƒ}|j |jƒ|    ƒWdQXt|ƒ}|j |jƒ|ƒWdQX|j|ƒ}
t|dƒ}|j    |
ƒWdQXt
|jd|ƒ\}}}|j |dƒ|j |dƒt|ƒ}|j |jƒ|
ƒWdQXt|ƒ}|jƒ} WdQXt| ddƒ|j |j|
dƒ| ƒWdQXdS(    Ns_test.pytws-dR    t~texecs-cs-r(tNonetmaxDiffRRRRRRtreadtwriteRR
t
assertTruetexiststcompileR,R2( Rt    directoryt    data_pathtftclosedR R Rtbackuptcleantbrokentindented((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt test_selftest;sL     
cCsp|j|j|dƒ|ƒ|j|j|dƒ|ƒ|j|ƒ}|j|j|ddddƒ|ƒdS(Ns-cs-ds-rs-es-st4(R
R,R2(RRBR@RC((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt pindent_testfscCs2tjdƒ}tjdƒ}|j||ƒdS(Ns:            if a:
                pass
 
            if a:
                pass
            else:
                pass
 
            if a:
                pass
            elif:
                pass
            else:
                pass
 
            while a:
                break
 
            while a:
                break
            else:
                pass
 
            for i in a:
                break
 
            for i in a:
                break
            else:
                pass
 
            try:
                pass
            finally:
                pass
 
            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            else:
                pass
 
            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            finally:
                pass
 
            with a:
                pass
 
            class A:
                pass
 
            def f():
                pass
            s`            if a:
                pass
            # end if
 
            if a:
                pass
            else:
                pass
            # end if
 
            if a:
                pass
            elif:
                pass
            else:
                pass
            # end if
 
            while a:
                break
            # end while
 
            while a:
                break
            else:
                pass
            # end while
 
            for i in a:
                break
            # end for
 
            for i in a:
                break
            else:
                pass
            # end for
 
            try:
                pass
            finally:
                pass
            # end try
 
            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            else:
                pass
            # end try
 
            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            finally:
                pass
            # end try
 
            with a:
                pass
            # end with
 
            class A:
                pass
            # end class A
 
            def f():
                pass
            # end def f
            (ttextwraptdedentRG(RRBR@((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyttest_statementsls
?    L    cCs2tjdƒ}tjdƒ}|j||ƒdS(Ns÷            def foobar(a, b):
                if a == b:
                    a = a+1
                elif a < b:
                    b = b-1
                    if b > a: a = a-1
                else:
                    print 'oops!'
            sJ            def foobar(a, b):
                if a == b:
                    a = a+1
                elif a < b:
                    b = b-1
                    if b > a: a = a-1
                    # end if
                else:
                    print 'oops!'
                # end if
            # end def foobar
            (RHRIRG(RRBR@((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyttest_multilevelýs
            cCstjdƒ}tjdƒ}|j|j|dƒ|ƒ|j|j|dƒ|ƒ|j|ƒ}|j|j|ddddƒ|ƒtjd    ƒ}tjd
ƒ}|j|j|dƒ|ƒ|j|j|dƒ|ƒ|j|ƒ}|j|j|dƒ|ƒdS( Ns\            if a:
                     if b:
                              pass
            s            if a:
                     if b:
                              pass
                     # end if
            # end if
            s-cs-ds-rs-es-st9sD            if a:
                if b:
                    pass
            so            if a:
                if b:
                    pass
                # end if
            # end if
            (RHRIR
R,R2(RRBR@RC((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyttest_preserve_indentss         %        cCsZtjdƒ}tjdƒ}|j|j|dƒ|ƒ|j|j|dƒ|ƒdS(Nsƒ            class\
            \
             A:
               def            \
            f:
                  pass
            s¸            class\
            \
             A:
               def            \
            f:
                  pass
               # end def f
            # end class A
            s-cs-d(RHRIR
R,(RRBR@((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyttest_escaped_newline9s     
   cCs2tjdƒ}tjdƒ}|j||ƒdS(Ns4            if a:
 
                pass
            sI            if a:
 
                pass
            # end if
            (RHRIRG(RRBR@((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyttest_empty_lineQs
        cCs2tjdƒ}tjdƒ}|j||ƒdS(Ns#            if a: pass
            s8            if a: pass
            # end if
            (RHRIRG(RRBR@((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt test_oneline_s
        (RRRRRRRRR,R2RERGRJRKRMRNRORP(((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyR(s                    +        ‘        "        cCs<tjgtƒjƒD]}t|tƒr|^qŒdS(N(Rt run_unittesttglobalstvaluest
isinstancettype(tobj((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt    test_mainjst__main__(t__doc__RR#tunittesttshutilR!t    sysconfigttempfileRHttestRttest.script_helperRRtis_python_buildtSkipTestRRtdirnamet__file__tbasepathRtTestCaseRRRWRtmain(((sW/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_tools.pyt<module>s*         0     ÿC