Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41360a4

Browse files
committed
Mass check-in after untabifying all files that need it.
1 parent cd0f59e commit 41360a4

36 files changed

Lines changed: 930 additions & 930 deletions

Lib/test/regrtest.py

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -30,58 +30,58 @@
3030

3131
def main():
3232
try:
33-
opts, args = getopt.getopt(sys.argv[1:], 'vgqx')
33+
opts, args = getopt.getopt(sys.argv[1:], 'vgqx')
3434
except getopt.error, msg:
35-
print msg
36-
print __doc__
37-
return 2
35+
print msg
36+
print __doc__
37+
return 2
3838
verbose = 0
3939
quiet = 0
4040
generate = 0
4141
exclude = 0
4242
for o, a in opts:
43-
if o == '-v': verbose = verbose+1
44-
if o == '-q': quiet = 1; verbose = 0
45-
if o == '-g': generate = 1
46-
if o == '-x': exclude = 1
43+
if o == '-v': verbose = verbose+1
44+
if o == '-q': quiet = 1; verbose = 0
45+
if o == '-g': generate = 1
46+
if o == '-x': exclude = 1
4747
if generate and verbose:
48-
print "-g and -v don't go together!"
49-
return 2
48+
print "-g and -v don't go together!"
49+
return 2
5050
good = []
5151
bad = []
5252
skipped = []
5353
for i in range(len(args)):
54-
# Strip trailing ".py" from arguments
55-
if args[i][-3:] == '.py':
56-
args[i] = args[i][:-3]
54+
# Strip trailing ".py" from arguments
55+
if args[i][-3:] == '.py':
56+
args[i] = args[i][:-3]
5757
if exclude:
58-
nottests[:0] = args
59-
args = []
58+
nottests[:0] = args
59+
args = []
6060
tests = args or findtests()
61-
test_support.verbose = verbose # Tell tests to be moderately quiet
61+
test_support.verbose = verbose # Tell tests to be moderately quiet
6262
for test in tests:
63-
if not quiet:
64-
print test
65-
ok = runtest(test, generate, verbose)
66-
if ok > 0:
67-
good.append(test)
68-
elif ok == 0:
69-
bad.append(test)
70-
else:
71-
if not quiet:
72-
print "test", test,
73-
print "skipped -- an optional feature could not be imported"
74-
skipped.append(test)
63+
if not quiet:
64+
print test
65+
ok = runtest(test, generate, verbose)
66+
if ok > 0:
67+
good.append(test)
68+
elif ok == 0:
69+
bad.append(test)
70+
else:
71+
if not quiet:
72+
print "test", test,
73+
print "skipped -- an optional feature could not be imported"
74+
skipped.append(test)
7575
if good and not quiet:
76-
if not bad and not skipped and len(good) > 1:
77-
print "All",
78-
print count(len(good), "test"), "OK."
76+
if not bad and not skipped and len(good) > 1:
77+
print "All",
78+
print count(len(good), "test"), "OK."
7979
if bad:
80-
print count(len(bad), "test"), "failed:",
81-
print string.join(bad)
80+
print count(len(bad), "test"), "failed:",
81+
print string.join(bad)
8282
if skipped and not quiet:
83-
print count(len(skipped), "test"), "skipped:",
84-
print string.join(skipped)
83+
print count(len(skipped), "test"), "skipped:",
84+
print string.join(skipped)
8585
return len(bad) > 0
8686

8787
stdtests = [
@@ -105,10 +105,10 @@ def findtests():
105105
names = os.listdir(testdir)
106106
tests = []
107107
for name in names:
108-
if name[:5] == "test_" and name[-3:] == ".py":
109-
modname = name[:-3]
110-
if modname not in stdtests and modname not in nottests:
111-
tests.append(modname)
108+
if name[:5] == "test_" and name[-3:] == ".py":
109+
modname = name[:-3]
110+
if modname not in stdtests and modname not in nottests:
111+
tests.append(modname)
112112
tests.sort()
113113
return stdtests + tests
114114

@@ -118,76 +118,76 @@ def runtest(test, generate, verbose):
118118
outputdir = os.path.join(testdir, "output")
119119
outputfile = os.path.join(outputdir, test)
120120
try:
121-
if generate:
122-
cfp = open(outputfile, "w")
123-
elif verbose:
124-
cfp = sys.stdout
125-
else:
126-
cfp = Compare(outputfile)
121+
if generate:
122+
cfp = open(outputfile, "w")
123+
elif verbose:
124+
cfp = sys.stdout
125+
else:
126+
cfp = Compare(outputfile)
127127
except IOError:
128-
cfp = None
129-
print "Warning: can't open", outputfile
128+
cfp = None
129+
print "Warning: can't open", outputfile
130130
try:
131-
save_stdout = sys.stdout
132-
try:
133-
if cfp:
134-
sys.stdout = cfp
135-
print test # Output file starts with test name
136-
__import__(test, globals(), locals(), [])
137-
finally:
138-
sys.stdout = save_stdout
131+
save_stdout = sys.stdout
132+
try:
133+
if cfp:
134+
sys.stdout = cfp
135+
print test # Output file starts with test name
136+
__import__(test, globals(), locals(), [])
137+
finally:
138+
sys.stdout = save_stdout
139139
except ImportError, msg:
140-
return -1
140+
return -1
141141
except KeyboardInterrupt, v:
142-
raise KeyboardInterrupt, v, sys.exc_info()[2]
142+
raise KeyboardInterrupt, v, sys.exc_info()[2]
143143
except test_support.TestFailed, msg:
144-
print "test", test, "failed --", msg
145-
return 0
144+
print "test", test, "failed --", msg
145+
return 0
146146
except:
147-
type, value = sys.exc_info()[:2]
148-
print "test", test, "crashed --", type, ":", value
149-
if verbose:
150-
traceback.print_exc(file=sys.stdout)
151-
return 0
147+
type, value = sys.exc_info()[:2]
148+
print "test", test, "crashed --", type, ":", value
149+
if verbose:
150+
traceback.print_exc(file=sys.stdout)
151+
return 0
152152
else:
153-
return 1
153+
return 1
154154

155155
def findtestdir():
156156
if __name__ == '__main__':
157-
file = sys.argv[0]
157+
file = sys.argv[0]
158158
else:
159-
file = __file__
159+
file = __file__
160160
testdir = os.path.dirname(file) or os.curdir
161161
return testdir
162162

163163
def count(n, word):
164164
if n == 1:
165-
return "%d %s" % (n, word)
165+
return "%d %s" % (n, word)
166166
else:
167-
return "%d %ss" % (n, word)
167+
return "%d %ss" % (n, word)
168168

169169
class Compare:
170170

171171
def __init__(self, filename):
172-
self.fp = open(filename, 'r')
172+
self.fp = open(filename, 'r')
173173

174174
def write(self, data):
175-
expected = self.fp.read(len(data))
176-
if data <> expected:
177-
raise test_support.TestFailed, \
178-
'Writing: '+`data`+', expected: '+`expected`
175+
expected = self.fp.read(len(data))
176+
if data <> expected:
177+
raise test_support.TestFailed, \
178+
'Writing: '+`data`+', expected: '+`expected`
179179

180180
def flush(self):
181-
pass
181+
pass
182182

183183
def close(self):
184-
leftover = self.fp.read()
185-
if leftover:
186-
raise test_support.TestFailed, 'Unread: '+`leftover`
187-
self.fp.close()
184+
leftover = self.fp.read()
185+
if leftover:
186+
raise test_support.TestFailed, 'Unread: '+`leftover`
187+
self.fp.close()
188188

189189
def isatty(self):
190-
return 0
190+
return 0
191191

192192
if __name__ == '__main__':
193193
sys.exit(main())

Lib/test/test_al.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
from test_support import verbose
77

88
alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams',
9-
'newconfig', 'openport', 'queryparams', 'setparams']
9+
'newconfig', 'openport', 'queryparams', 'setparams']
1010

1111
# This is a very inobstrusive test for the existance of the al module and all it's
1212
# attributes. More comprehensive examples can be found in Demo/al
1313

1414
def main():
1515
# touch all the attributes of al without doing anything
1616
if verbose:
17-
print 'Touching al module attributes...'
17+
print 'Touching al module attributes...'
1818
for attr in alattrs:
19-
if verbose:
20-
print 'touching: ', attr
21-
getattr(al, attr)
19+
if verbose:
20+
print 'touching: ', attr
21+
getattr(al, attr)
2222

2323
main()
2424

Lib/test/test_array.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@ def main():
1010
testtype('c', 'c')
1111

1212
for type in (['b', 'h', 'i', 'l', 'f', 'd']):
13-
testtype(type, 1)
13+
testtype(type, 1)
1414

1515
unlink(TESTFN)
1616

1717

1818
def testtype(type, example):
1919

20-
a = array.array(type)
21-
a.append(example)
22-
if verbose:
23-
print 40*'*'
24-
print 'array after append: ', a
25-
a.typecode
26-
a.itemsize
27-
if a.typecode in ('i', 'b', 'h', 'l'):
28-
a.byteswap()
29-
30-
if a.typecode == 'c':
31-
f = open(TESTFN, "w")
32-
f.write("The quick brown fox jumps over the lazy dog.\n")
33-
f.close()
34-
f = open(TESTFN, 'r')
35-
a.fromfile(f, 10)
36-
f.close()
37-
if verbose:
38-
print 'char array with 10 bytes of TESTFN appended: ', a
39-
a.fromlist(['a', 'b', 'c'])
40-
if verbose:
41-
print 'char array with list appended: ', a
42-
43-
a.insert(0, example)
44-
if verbose:
45-
print 'array of %s after inserting another:' % a.typecode, a
46-
f = open(TESTFN, 'w')
47-
a.tofile(f)
48-
f.close()
49-
a.tolist()
50-
a.tostring()
51-
if verbose:
52-
print 'array of %s converted to a list: ' % a.typecode, a.tolist()
53-
if verbose:
54-
print 'array of %s converted to a string: ' \
55-
% a.typecode, `a.tostring()`
20+
a = array.array(type)
21+
a.append(example)
22+
if verbose:
23+
print 40*'*'
24+
print 'array after append: ', a
25+
a.typecode
26+
a.itemsize
27+
if a.typecode in ('i', 'b', 'h', 'l'):
28+
a.byteswap()
29+
30+
if a.typecode == 'c':
31+
f = open(TESTFN, "w")
32+
f.write("The quick brown fox jumps over the lazy dog.\n")
33+
f.close()
34+
f = open(TESTFN, 'r')
35+
a.fromfile(f, 10)
36+
f.close()
37+
if verbose:
38+
print 'char array with 10 bytes of TESTFN appended: ', a
39+
a.fromlist(['a', 'b', 'c'])
40+
if verbose:
41+
print 'char array with list appended: ', a
42+
43+
a.insert(0, example)
44+
if verbose:
45+
print 'array of %s after inserting another:' % a.typecode, a
46+
f = open(TESTFN, 'w')
47+
a.tofile(f)
48+
f.close()
49+
a.tolist()
50+
a.tostring()
51+
if verbose:
52+
print 'array of %s converted to a list: ' % a.typecode, a.tolist()
53+
if verbose:
54+
print 'array of %s converted to a string: ' \
55+
% a.typecode, `a.tostring()`
5656

5757

5858
main()
59-
59+

0 commit comments

Comments
 (0)